Oracle constraint name is known.
How do I find the name of the table for which this constraint is applied?
Use the view table_constraints in the information_schema schema. The column table_name gives you the name of the table in which the constraint is defined, and the column constraint_name contains the name of the constraint.
No - a constraint is a database object as well, and thus its name needs to be unique.
Discussion: In Oracle, use the view user_constraints to display the names of the constraints in the database. The column constraint_name contains the name of the constraint, constraint_type indicates the type of constraint, and table_name contains the name of the table to which the constraint belongs.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With