Thursday, September 22, 2016

FOREIGN KEY CONSTRAINTS NOTES


  •  

    FK Constraints

    FOREIGN KEY CONSTRAINTS NOTES:
  • Table Owner - Owner of the table
  • Table Name - Name of the table
  • Constraint Name - Name of the constraint
  • Column Name - Name of the column
  • Referenced Table - Name of the referenced table
  • Reference Column - Name of the referenced column
  • Position - Position of the column

    select  c.OWNER,
     c.TABLE_NAME,
     c.CONSTRAINT_NAME,
     cc.COLUMN_NAME,
     r.TABLE_NAME,
     rc.COLUMN_NAME,
     cc.POSITION
    from  dba_constraints c, 
     dba_constraints r, 
     dba_cons_columns cc, 
     dba_cons_columns rc
    where  c.CONSTRAINT_TYPE = 'R'
    and  c.OWNER not in ('SYS','SYSTEM')
    and  c.R_OWNER = r.OWNER
    and  c.R_CONSTRAINT_NAME = r.CONSTRAINT_NAME
    and  c.CONSTRAINT_NAME = cc.CONSTRAINT_NAME
    and  c.OWNER = cc.OWNER
    and  r.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
    and  r.OWNER = rc.OWNER
    and  cc.POSITION = rc.POSITION
    order  by c.OWNER, c.TABLE_NAME, c.CONSTRAINT_NAME, cc.POSITION
  • No comments:

    Post a Comment

    How To Fix Hive – Partition Table Query Failed When Stored As Parquet

    This article is about the bug in Hive filtering option, when the partition table query stored as parquet. Big data developers will help y...