Home » SQL & PL/SQL » SQL & PL/SQL » Find foreign keys between two tables
Find foreign keys between two tables [message #229132] Thu, 05 April 2007 09:00 Go to next message
rudorathod
Messages: 14
Registered: October 2006
Junior Member
How do I find out the referential keys between two tables writing a SQL query?

suppose in I have a table A and table B with a common column col1
and I want to write a query, so it gives me a result as col1 as a common field

Thanks
Re: Find foreign keys between two tables [message #229138 is a reply to message #229132] Thu, 05 April 2007 09:14 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

user/all/dba_constraints.

Regards
Michel
Re: Find foreign keys between two tables [message #229216 is a reply to message #229138] Fri, 06 April 2007 01:26 Go to previous messageGo to next message
pavuluri
Messages: 247
Registered: January 2007
Senior Member
hi

Michel Cadot and all

asume that

i have scott schema.
it has emp, dept tables it has common key deptno.

how can i found common key with sql query.

is it possible?

i think requirement is clear.

thanks,
srinivas
Re: Find foreign keys between two tables [message #229220 is a reply to message #229216] Fri, 06 April 2007 01:37 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Query the views I previously posted.
I think answer is clear. Smile

Regards
Michel


Re: Find foreign keys between two tables [message #229223 is a reply to message #229220] Fri, 06 April 2007 01:46 Go to previous messageGo to next message
pavuluri
Messages: 247
Registered: January 2007
Senior Member
asume that i have sevaral tables in schema

how can i find Dependencies?

Thanks
sriniavas
Re: Find foreign keys between two tables [message #229224 is a reply to message #229223] Fri, 06 April 2007 01:50 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Did you just try to look at and understand these views?

Regards
Michel
Re: Find foreign keys between two tables [message #229225 is a reply to message #229224] Fri, 06 April 2007 01:55 Go to previous messageGo to next message
pavuluri
Messages: 247
Registered: January 2007
Senior Member
i am understand

but my reqiurement is

i have schema has 200 tables

how can i find Dependencies in all tables?

is any way please tell me.

thanks,
srinivas


Re: Find foreign keys between two tables [message #229226 is a reply to message #229225] Fri, 06 April 2007 01:56 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10672
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Apart from what was already posted, Look into user_dependencies.
You can get any fancy here (just for an example)
http://www.orafaq.com/forum/m/174231/42800/?srch=user_dependencies#msg_173685

[Updated on: Fri, 06 April 2007 01:58]

Report message to a moderator

Re: Find foreign keys between two tables [message #229227 is a reply to message #229226] Fri, 06 April 2007 02:05 Go to previous messageGo to next message
pavuluri
Messages: 247
Registered: January 2007
Senior Member
i want only tables not procs

thanks,
srinivas
Re: Find foreign keys between two tables [message #229229 is a reply to message #229227] Fri, 06 April 2007 02:08 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10672
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Did you atleast go through the complete thread?
As i said before, you can get any 'fancy'.
The thread deals with procedures(requirement of OP). With a little tweak you can make it work for tables. All information needed is available in user_objects/user_dependencies/user_constraints.
Re: Find foreign keys between two tables [message #229232 is a reply to message #229229] Fri, 06 April 2007 02:27 Go to previous messageGo to next message
pavuluri
Messages: 247
Registered: January 2007
Senior Member
thanks Mahesh
Re: Find foreign keys between two tables [message #229236 is a reply to message #229232] Fri, 06 April 2007 03:24 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Maybe a tip for you, pavuluri: reread the replies you got and wait just a minute before posting your reply. Over the last couple of days you had numerous posts that irritated people, just because you were either too lazy to (completely) read links people posted, or because you simply replied by reposting your previous reply.
It's just a suggestion...
Previous Topic: ERROR : PLS-00455: cursor 'CUR' cannot be used in dynamic SQL OPEN statement
Next Topic: Help on questions faced at interview
Goto Forum:
  


Current Time: Sun Dec 04 06:26:22 CST 2016

Total time taken to generate the page: 0.06470 seconds