Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions contrib/orafce/expected/varchar2.out
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,13 @@ select * from basictestvarchar2;
(2 rows)

create table test_var(c1 varchar2, c2 varchar2);
insert into test_var values('1', 'test1'),('1', 'test1'),('2', 'test1'),('2', 'test2');
create table test_tmp(c1 varchar2, c2 varchar2);
insert into test_tmp values('1', 'test1'),('2', 'test1');
select * from test_var where(c1, c2) not in (select * from test_tmp);
c1 | c2
----+-------
2 | test2
(1 row)

22 changes: 22 additions & 0 deletions contrib/orafce/orafce--3.17.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3098,6 +3098,28 @@ CREATE OPERATOR oracle.< (
NEGATOR = operator(oracle.>=)
);

/* create operator class of varchar2 */
CREATE OPERATOR CLASS oracle.varchar2_ops DEFAULT FOR TYPE oracle.varchar2 USING hash family text_ops AS OPERATOR 1 oracle.=;

CREATE FUNCTION oracle.varchar2operator(oracle.varchar2, oracle.varchar2) RETURNS int AS $$
BEGIN
IF($1<$2) THEN
RETURN -1;
ELSIF($1>$2) THEN
RETURN 1;
END IF;
RETURN 0;
END;
$$
language 'plpgsql' immutable;

CREATE OPERATOR CLASS oracle.varchar2_ops DEFAULT FOR TYPE oracle.varchar2 USING btree family text_ops AS
OPERATOR 1 oracle.<,
OPERATOR 2 oracle.<=,
OPERATOR 3 oracle.=,
OPERATOR 4 oracle.>=,
OPERATOR 5 oracle.>,
FUNCTION 1 oracle.varchar2operator(oracle.varchar2, oracle.varchar2);
/*-----------------------------------------------------------------
* add operator, avoid implicit cast
* end
Expand Down
5 changes: 5 additions & 0 deletions contrib/orafce/sql/varchar2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -453,3 +453,8 @@ COPY basictestvarchar2 (testchar) FROM stdin;
老师你好吗
\.
select * from basictestvarchar2;
create table test_var(c1 varchar2, c2 varchar2);
insert into test_var values('1', 'test1'),('1', 'test1'),('2', 'test1'),('2', 'test2');
create table test_tmp(c1 varchar2, c2 varchar2);
insert into test_tmp values('1', 'test1'),('2', 'test1');
select * from test_var where(c1, c2) not in (select * from test_tmp);