Primary key and foreign constraint in oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashwani123
    New Member
    • Mar 2012
    • 1

    Primary key and foreign constraint in oracle

    Hi,

    Is there any system table that stores theprimary key column name,table name, foreign key column name and table name in the oracle database?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Use all_constraints
    Code:
    SELECT a.owner, a.table_name, b.column_name
      FROM all_constraints a, all_cons_columns b
     WHERE a.constraint_type='P'
       AND a.constraint_name=b.constraint_name
       AND a.table_name = 'yourTableName'

    Comment

    Working...