oracle.rst
changeset 2218 39e18e1912b7
parent 2217 3005f2860e3c
child 2219 f991bbf12a59
equal deleted inserted replaced
2217:3005f2860e3c 2218:39e18e1912b7
   157 
   157 
   158 List tables that has foreign key to given table::
   158 List tables that has foreign key to given table::
   159 
   159 
   160   select * from SYS.USER_CONSTRAINTS cons
   160   select * from SYS.USER_CONSTRAINTS cons
   161     join SYS.USER_CONSTRAINTS rcons on rcons.CONSTRAINT_NAME = cons.R_CONSTRAINT_NAME
   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';
   162     where cons.CONSTRAINT_TYPE = 'R' and rcons.TABLE_NAME = 'TBL_NAME';
   163 
   163 
   164   select * from SYS.USER_CONSTRAINTS cons
   164   select * from SYS.USER_CONSTRAINTS cons
   165     join SYS.USER_CONSTRAINTS rcons on rcons.CONSTRAINT_NAME = cons.R_CONSTRAINT_NAME
   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 '/';
   166     where cons.CONSTRAINT_TYPE = 'R' and rcons.TABLE_NAME like '%/_OLD' escape '/';
   167 
   167