There is an Oracle database link between Oracle and PostgreSQL database through Heterogeneous Service ( HS ).
The sql query is working fine in PostgreSQL database:
testdb=> \d test_tbl
Table "testuser.test_tbl"
Column | Type | Collation | Nullable | Default
--------+-------------------------+-----------+----------+---------
id | double precision | | |
s10 | character varying(10) | | |
s20 | character varying(20) | | |
s30 | character varying(2048) | | |
testdb=> select * from test_tbl;
id | s10 | s20 | s30
----+--------+--------+---------------
1 | tets1 | test2 | Test Record 1
(1 row)
testdb=>select "id", substr("s10",1,5),
substr("s20",1,5),substr("s30",1,10)
from test_tbl;
id | substr | substr | substr
---+--------+--------+------------
1 | test1 | test2 | Test Recor
(1 row)
While running the same query in Oracle database through Heterogeneous Service ( HS ) database link, get “ORA-00932: inconsistent datatypes” error. Sometimes you might get “ORA-02070: database does not support TO_CHAR in this context”.
SQL> select "id", substr("s10",1,5),substr("s20",1,5),substr("s30",1,10)
from "test_tbl"@PGLINK;
select "id", substr("s10",1,5),substr("s20",1,5), substr("s30",1,10)
from "test_tbl"@PGLINK
*
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected CHAR got LONG
Subscribe to get access
Read more of this content when you subscribe today.