|
|
 |
| Oracle General Oracle database discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Oracle section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

October 14th, 2009, 11:11 PM
|
|
Authorized User
|
|
Join Date: Sep 2008
Location: , , Singapore.
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Querying from 2 databases
Hi,
I have two oracle databases db1 & db2 residing on the same server
i need to write a query joining one table from db1 and other from db2
how can i do this?
|

October 15th, 2009, 03:46 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Location: India
Posts: 563
Thanks: 0
Thanked 14 Times in 14 Posts
|
|
Create a database link.
You have the two databases: "Database1" and "Database2".
In "Database1", create a link to "Database2"
like so: (logged in as user with create link privilege)
create public database link "Database2"
connect to "Database2user" identified by "Database2userpassword" using "Database2";
Then in Database1, you should be able to write a select statement along these lines:
SELECT tab1.col1, tab2.col2 FROM table1 tab1 --table in "Database1",table2@"Database2" tab2 --table in "Database2"
__________________
Om Prakash Pant
Last edited by om_prakash : October 15th, 2009 at 03:50 AM.
|

October 15th, 2009, 05:32 AM
|
|
Authorized User
|
|
Join Date: Sep 2008
Location: , , Singapore.
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
thanks .. is there any other way other than creating dblink..
|

November 18th, 2009, 12:17 AM
|
|
Authorized User
|
|
Join Date: Nov 2006
Location: Bangalore, Karnataka, India.
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
|
|
You have to create dblink to connect two different databases.
__________________
Regards
Debasis
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |