rem ********************************************************************
rem * Author            : Rick Kupcunas
rem * Original          : 17-MAY-95
rem * Description       : Shows the constraints for a given tablet
rem * Usage             : start show_con.sql <date>  e.g. 03-MAR-95
rem *                                        <Program Name>
rem *                                        <Max run time (min.)>
rem *
rem ********************************************************************

spool show_con.rslt;

set pagesize 100;
set linesize 132;
set long 30;
break on "STATUS" on "TYPE" on "CONSTRAINT";

select distinct 'ALL CONSTRAINTS FOR: '||owner||'.'||table_name "PURPOSE" 
from sys.dba_constraints
  where table_name = upper('&&TABLE_NAME');

select status                       	"STATUS",
       constraint_type              	"TYPE",
       substr(constraint_name,1,25) 	"CONSTRAINT",
       substr(r_constraint_name,1,25) 	"REF. INTEGRITY KEY",
       search_condition     		"CONDITION"
  from sys.dba_constraints
  where table_name = upper('&&TABLE_NAME')
order by 1,2,3;

spool off;
undefine TABLE_NAME;

