dbTalk Databases Forums  

accessing multiple instances

comp.databases.oracle comp.databases.oracle


Discuss accessing multiple instances in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
naimy
 
Posts: n/a

Default accessing multiple instances - 07-18-2004 , 02:48 PM






Hi,
I need to access more that 1 instance, is there a way to start a new
connection from a pl/sql script ?
eg.
inst1 has table I1
inst2 has table I2

I need to query I2 using columns from I1. It may sound unusual
etc.etc.

I have stored the field-values its just one column from I1 and want to
connect to I2.
I thought that the following would work, but it didnt


declare
begin
execute immediate 'conn abc/abc@inst2 ';
end;
/

Want to run something like this


declare
curosr c is
select 1,2,3,4 from inst1.table1 where ---- ;
c_rec is c%rowtype;

begin
for c_rec in c loop
-- get the c_rec.1 value and query inst2

select c1 into holder1 from inst2.table2 where (.....);

end loop;
end;
/


Thanks,
Naimy

Reply With Quote
  #2  
Old   
sybrandb@yahoo.com
 
Posts: n/a

Default Re: accessing multiple instances - 07-19-2004 , 03:02 AM






naimy4 (AT) yahoo (DOT) com (naimy) wrote in message news:<d028e345.0407181148.89f12d0 (AT) posting (DOT) google.com>...
Quote:
Hi,
I need to access more that 1 instance, is there a way to start a new
connection from a pl/sql script ?
eg.
inst1 has table I1
inst2 has table I2

I need to query I2 using columns from I1. It may sound unusual
etc.etc.

I have stored the field-values its just one column from I1 and want to
connect to I2.
I thought that the following would work, but it didnt


declare
begin
execute immediate 'conn abc/abc@inst2 ';
end;
/

Want to run something like this


declare
curosr c is
select 1,2,3,4 from inst1.table1 where ---- ;
c_rec is c%rowtype;

begin
for c_rec in c loop
-- get the c_rec.1 value and query inst2

select c1 into holder1 from inst2.table2 where (.....);

end loop;
end;
/


Thanks,
Naimy
You can't have multiple connections in PL/SQL.
As Oracle supports the distributed database concept, you also don't
need them, as you have database links.
You'll need to set up a database link
(create database link foo connect to bar identified by password using
'<tns servicename>'
)
and issue your query like
select * from <table>@<databaselink name>

Sybrand Bakker
Senior Oracle DBA


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.