p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Database > Oracle
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 14th, 2009, 11:11 PM
Authorized User
Points: 380, Level: 6
Points: 380, Level: 6 Points: 380, Level: 6 Points: 380, Level: 6
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Sep 2008
Location: , , Singapore.
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old October 15th, 2009, 03:46 AM
Friend of Wrox
Points: 1,882, Level: 17
Points: 1,882, Level: 17 Points: 1,882, Level: 17 Points: 1,882, Level: 17
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: May 2004
Location: India
Posts: 563
Thanks: 0
Thanked 14 Times in 14 Posts
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old October 15th, 2009, 05:32 AM
Authorized User
Points: 380, Level: 6
Points: 380, Level: 6 Points: 380, Level: 6 Points: 380, Level: 6
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Sep 2008
Location: , , Singapore.
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default

thanks .. is there any other way other than creating dblink..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old November 18th, 2009, 12:17 AM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Nov 2006
Location: Bangalore, Karnataka, India.
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via ICQ to debasisdas Send a message via AIM to debasisdas Send a message via MSN to debasisdas Send a message via Yahoo to debasisdas Send a message via Skype™ to debasisdas
Default

You have to create dblink to connect two different databases.
__________________
Regards
Debasis
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Querying Two tables hugh@kmcnetwork.com BOOK: Professional SQL Server 2000 Programming 3 October 6th, 2008 02:28 PM
Error querying LDAP bala24 General .NET 0 March 7th, 2007 10:08 PM
Querying against truncated dates John Pennington SQL Server 2000 3 October 17th, 2006 12:55 AM
Querying a textfile in QA daniel SQL Server 2000 10 February 1st, 2006 01:51 AM
Querying .csv files aspiring_db_fundu Excel VBA 4 February 25th, 2004 01:01 PM



All times are GMT -4. The time now is 07:30 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc