Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Foriegn key reference table in oracle
Closed Thread
Old 09-09-2008, 10:38 AM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2008

Posts: 2

vishnunekkanti is on a distinguished road

Smile Foriegn key reference table in oracle

Hello

Can any one help me how I can find a table that has foreign key references from other table?

Thanks in advance


Vishnu
vishnunekkanti is offline  
Old 09-12-2008, 02:20 AM   #2 (permalink)
mikesgroovin's Avatar
 
HONK if you route packets

Join Date: Sep 2003

Posts: 4,664

mikesgroovin will become famous soon enoughmikesgroovin will become famous soon enough

Default Re: Foriegn key reference table in oracle

There are a few ways to view them but it would help knowing a little more about what you want to accomplish. Given your post, to list all of them just do a statement that lists all the records from SYS.ALL_CONSTRAINTS and SYS.ALL_CONS_COLUMNS. You are going to have duplicate records though if you don't join the tables. I don't have access to a DB in front of me, so the exact names of the columns that you need to join escape me. But, if you look at the tables, the columns you need to join in order to not get dup record results will be pretty clear. I think "owner" is one of them... lol i don't know. It's pretty obvious if you do a "select *" though from both tables independently. Or just view the table structures and the names of the columns should be similar if not exactly the same.
__________________
A+, Net+, Sec+, Server+, Linux+, MOUS(2000 & '03), MCSE, MCSA, MCT, CNA, CCNA, CCDA, CCNP, CCSP

Last edited by mikesgroovin; 09-12-2008 at 02:22 AM.
mikesgroovin is offline  
Old 07-15-2009, 10:25 AM   #3 (permalink)
 
Newb Techie

Join Date: Jul 2009

Posts: 1

Suman Gadikrindi is on a distinguished road

Thumbs up Re: Foriegn key reference table in oracle

Quote:
Originally Posted by vishnunekkanti View Post
Hello

Can any one help me how I can find a table that has foreign key references from other table?

Thanks in advance


Vishnu
Enjoy with the following statement :happy: :

select acc.table_name REFERENCING_TABLE_NAME, acc.column_name REFERENCING_COLUMN_NAME
from all_constraints ac1,
all_constraints ac2,
all_cons_columns acc
where ac1.constraint_type = 'P'
and ac1.table_name = :table_name
and ac2.r_constraint_name = ac1.constraint_name
and ac2.constraint_name = acc.constraint_name;

Regards,
Suman Gadikrindi
Logica
Suman Gadikrindi is offline  
 
Closed Thread

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Computer Still acting screwy Shana2415 Virus - Spyware Protection / Detection 10 09-03-2008 11:36 AM
Seeminly Unsolveable Problem! Reply ASAP! yoshi1476 Windows Operating Systems and Software 44 06-13-2008 12:48 AM
Need steps for getting rid of SystemDefender.exe Trotter Virus - Spyware Protection / Detection 16 04-07-2008 06:57 PM