Hello,
I created one table say "Table1" with one column say "Column1" with constraint Not Null. Oracle generated its own name for this constraint. Say SYS_C#########.
I want to delete this constraint using one sql script. But how i will find out the constraint name to drop this constraint?
-Dhiraj
Hi,
All the Not null constraints will be stored in a table called ALL_CONS_COLUMNS which has Owner, table_name,column_name,constraint_name and position(in case of primary key)
So to get the constraint name for just a NOT NULL constraint your query would look like this :
-
-
SELECT CONSTRAINT_NAME FROM ALL_CONS_COLUMNS WHERE OWNER = <user_name> AND TABLE_NAME = <table_name>
-
AND COLUMN_NAME = <column_name>
-