DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: primary key foriegn key relationship

  1. #1
    Join Date
    Jan 2001
    Posts
    157

    Question

    Is there any way that I can find out what tables uses columns from another table as their thier foreign keys?(i.e. is primary key foreign key relation ship)

    Can anybody paste a script that does that?

  2. #2
    Join Date
    Jun 2000
    Posts
    295
    I use:

    select p.TABLE_NAME PARENT_TABLE,
    p.CONSTRAINT_NAME PK,
    c.TABLE_NAME CHILD_TABLE,
    c.CONSTRAINT_NAME FK
    from user_constraints c, user_constraints p
    where c.CONSTRAINT_TYPE = 'R'
    and c.R_CONSTRAINT_NAME = p.CONSTRAINT_NAME
    and c.TABLE_NAME like upper('%&table_name%')


    Hope it helps

  3. #3
    Join Date
    Jan 2001
    Posts
    157
    thank you sysdba. It helped

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width