Home » SQL & PL/SQL » SQL & PL/SQL » doing a select on multiple databases in a single query
doing a select on multiple databases in a single query [message #358862] Wed, 12 November 2008 14:18 Go to next message
ramy
Messages: 3
Registered: November 2008
Junior Member
Hi,
I want to do a select on 2 databases(both oracle) in a single query and obtain the columns from both.
How to do this..as each db has its own credentials..i can't do something like db1.table1.column1 and db2.table1.column1.
Any help is appreciated.

Thanks
R
Re: doing a select on multiple databases in a single query [message #358865 is a reply to message #358862] Wed, 12 November 2008 14:34 Go to previous messageGo to next message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
@ramy,

One way of acheiving this is via a DATABASE LINK

Hope this helps.

Regards,
Jo
Re: doing a select on multiple databases in a single query [message #358870 is a reply to message #358862] Wed, 12 November 2008 15:11 Go to previous messageGo to next message
ramy
Messages: 3
Registered: November 2008
Junior Member
Thanks for the reply..currently i have only select priviliges on the tables of both the dbs.So is it possible to do a database link between the current and remote databases.

When i do a select global_name from global_name; it shows only my current database service name.
Or do i need additional priviliges.
Re: doing a select on multiple databases in a single query [message #358871 is a reply to message #358870] Wed, 12 November 2008 15:15 Go to previous messageGo to next message
rishg
Messages: 9
Registered: March 2008
Junior Member
You will need create database link privileges in DB1.
Re: doing a select on multiple databases in a single query [message #358899 is a reply to message #358862] Wed, 12 November 2008 21:59 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

Please read the documentation properly .

You need to refer to the objects in other Database specifically using the sufix '@dblinkname'

Smile
Rajuvan.
Re: doing a select on multiple databases in a single query [message #359116 is a reply to message #358862] Thu, 13 November 2008 15:14 Go to previous message
ramy
Messages: 3
Registered: November 2008
Junior Member
thanks guys..i found these links which might be useful
for future reference http://youngcow.net/doc/oracle10g/server.102/b14200/statements_5005.htm

http://www.akadia.com/services/ora_dblinks.html
Previous Topic: modify sql to select only non-alphabetic emplid's
Next Topic: can compile procedure but cannot execute it
Goto Forum:
  


Current Time: Sat Feb 08 20:52:58 CST 2025