My Oracle Support Banner

Wrong Results For Query Using A Dblink (Doc ID 730599.1)

Last updated on MARCH 02, 2020

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.1 to 10.2.0.4 [Release 9.2 to 10.2]
Information in this document applies to any platform.
This problem can occur on any platform.

Symptoms

Following SELECT with remote objects and local dual works and returns 1 row:

SQL> select a.a, a.b, a.c, a.d, a.e, a.f, a.g, a.h , decode (b.<COL1>,null,'-1',b.<COL1>) <ALIAS>
from
(select 1 join, 9999 a, 98765 b, 20 c, 1129662642 d, 1 e, -1 f, 50 g, 'A' h from dual) a,
(select 1 join , ip.<COL1> from <OWNER>.<TABLE>@<DBLINK> tc,
<OWNER>.<TABLE1>@<DBLINK> ip
where tc.<COL2>=-1 and tc.<COL3>=ip.<COL3>) b
where a.join=b.join(+);

A B C D E F G H <ALIAS>
---------- ---------- ---------- ---------- ---------- ---------- ---------- -
9999 98765 20 1129662642 1 -1 50 A  -1


However, INSERT REMOTE using same SELECT as above does not insert any rows:

SQL> insert into <OWNER>.<TABLE>@<DBLINK> c
(col1, col2, col3, col4, col5, col6,
col7, col8, col9)
select  a.a, a.b, a.c, a.d, a.e, a.f, a.g, a.h , decode (b.<COL1>,null,'-1',b.<COL1>) <ALIAS>
from (select 1 join, 9999 a, 98765 b, 20 c, 1129662642 d, 1 e, -1 f, 50 g, 'A' h from dual ) a,
(select 1 join , ip.<COL1> from <OWNER>.<TABLE>@<DBLINK> tc,
<OWNER>.<TABLE1>@<DBLINK> ip
where tc.<COL2>=-1 and tc.<COL3>=ip.<COL3>) b
where a.join=b.join(+);


0 rows created.



Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.