Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query over dblink

ATDDec 20 2013 — edited Dec 20 2013

Hi All,


I have two 11g databases - say, DB1 and DB2 - and am trying to query over a dblink from DB1 to DB2 something like:


SELECT

     /*+ DRIVING_SITE(A) */

     A.FIELD1,

     B.FIELD1

FROM

     TABLE1@DBLINK_DB2 A

     INNER JOIN TABLE2@DBLINK_DB2 B

          ON A.FKFIELD = B.PKFIELD;


This takes some time to return data when trying to INSERT this data into a table.  Looking at the session info for DB2, I see that this query is being rewritten as something like:


SELECT 

     "A2"."FIELD1", 

     "A2"."FIELD2",

     "A2"."FIELD3",

     .... etc,

     "A2"."FIELD100",

     "A1"."FIELD1",

     "A1"."FIELD2",

     "A1"."FIELD3",

     .... etc,

     "A1"."FIELD100"

FROM 

     "TABLE1" "A1",

     "TABLE2" "A2"

WHERE

     "A1"."FKFIELD" = "A2"."PKFIELD";


Presumably, this is then restricted to just the two coIumns actually want, which is then returned via the dblink


So, my question is:  How can I stop it doing a SELECT on ALL columns in the tables where I only want just the two that I have specified?  Is there a hint that I can use?


Thanks


Andy

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2014
Added on Dec 20 2013
11 comments
687 views