RE: using different database (SID) in a subselect with SQL*Plus / Shell Scripts

From: Powell, Mark <mark.powell2_at_hp.com>
Date: Wed, 23 Nov 2011 15:47:57 +0000
Message-ID: <7C4BF3B32B80CC44AE37D31B172415937DD158F6B2_at_GVW1337EXC.americas.hpqcorp.net>



On the database you are connecting to you would create a database link to the remote database and then either reference the link in the sub-select or create a synonym for the remote object that provides the link:

Select testfield from test2_at_remote

HTH -- Mark D Powell --

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sven Aluoor Sent: Wednesday, November 23, 2011 10:38 AM To: oracle-l_at_freelists.org
Subject: using different database (SID) in a subselect with SQL*Plus / Shell Scripts

Hi

I have this simplified SQL statement within Shell Script.

function ()
{
sqlplus -S $DBO/$DBOPW_at_$ORACLE_SID <<EOF > /opt/test/output.$(/bin/date '+%d%m%Y.%Hh') set echo Off
[...]
set linesize 20000

SELECT testfield from test where testfield not in (select testfield from test2); exit
EOF
}

The problem is that the subselect (select testfield from test2) is an other oracle database (not the one connected on with sqlplus). Howto to that with SQL*Plus and Shell Scripts?

cheers Sven
--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l Received on Wed Nov 23 2011 - 09:47:57 CST

Original text of this message