Get table name by constraint name [duplicate] Get table name by constraint name [duplicate] oracle oracle

Get table name by constraint name [duplicate]


SELECT owner, table_name  FROM dba_constraints WHERE constraint_name = <<your constraint name>>

will give you the name of the table. If you don't have access to the DBA_CONSTRAINTS view, ALL_CONSTRAINTS or USER_CONSTRAINTS should work as well.


ALL_CONSTRAINTS describes constraint definitions on tables accessible to the current user.

DBA_CONSTRAINTS describes all constraint definitions in the database.

USER_CONSTRAINTS describes constraint definitions on tables in the current user's schema

Select CONSTRAINT_NAME,CONSTRAINT_TYPE ,TABLE_NAME ,STATUS from USER_CONSTRAINTS;


SELECT constraint_name, constraint_type, column_namefrom user_constraints natural join user_cons_columnswhere table_name = "my_table_name";

will give you what you need