oracle.rst
changeset 2216 303e4963ffc5
parent 2194 60f74f8b5967
child 2217 3005f2860e3c
equal deleted inserted replaced
2215:3b163a0580fc 2216:303e4963ffc5
   153     where TABLE_NAME not in (
   153     where TABLE_NAME not in (
   154       select distinct TABLE_NAME from ALL_CONSTRAINTS where CONSTRAINT_TYPE = 'P'
   154       select distinct TABLE_NAME from ALL_CONSTRAINTS where CONSTRAINT_TYPE = 'P'
   155     ) and OWNER in ('USER1', 'USER2')
   155     ) and OWNER in ('USER1', 'USER2')
   156     order by OWNER, TABLE_NAME;
   156     order by OWNER, TABLE_NAME;
   157 
   157 
       
   158 List tables that has foreign key to given table::
       
   159 
       
   160   select * from SYS.USER_CONSTRAINTS cons
       
   161     join SYS.USER_CONSTRAINTS rcons on rcons.CONSTRAINT_NAME = cons.R_CONSTRAINT_NAME
       
   162     where cons.CONSTRAINT_TYPE = 'R' and rcons.TABLE_NAME 'TBL_NAME';
       
   163 
       
   164   select * from SYS.USER_CONSTRAINTS cons
       
   165     join SYS.USER_CONSTRAINTS rcons on rcons.CONSTRAINT_NAME = cons.R_CONSTRAINT_NAME
       
   166     where cons.CONSTRAINT_TYPE = 'R' and rcons.TABLE_NAME like '%/_OLD' escape '/';
       
   167 
   158 List of current constraints limited to current user::
   168 List of current constraints limited to current user::
   159 
   169 
   160   select * from USER_CONSTRAINTS;
   170   select * from USER_CONSTRAINTS;
   161 
   171 
   162 List of constraints available to user::
   172 List of constraints available to user::