How to list all constraints in Oracle database

You can list all constraints and tables to which they are linked via this SQL statement:

SELECT constraint_name, 
       Decode(constraint_type, 'C', 'Check constraint on a table', 
                               'P', 'Primary key', 
                               'U', 'Unique key', 
                               'R', 'Referential integrity', 
                               'V', 'With check option, on a view', 
                               'O', 'With read only, on a view', 
                               'H', 'Hash expression', 
                               'F', 'Constraint that involves a REF column', 
                               'S', 'Supplemental logging')constraint_type, 
       table_name 
FROM   user_constraints;

 

Leave a Reply

Your email address will not be published. Required fields are marked *