Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Cannot drop SYS_ constraints - Why?
First, what do you mean by "...many duplicate SYS_ constraints on many columns." ? How did you reach this conclusion ?
Second, the NOT NULL condition on any table column is enforced by ORACLE through a CHECK constraint (constraint_type='C'), i.e. CHECK (<column_name IS NOT NULL). Usually, no DBA bothers to create a constraint name for a NOT NULL condition, therefore these are named by ORACLE in the standard SYS_Cnnn format. Those are probably what you mistakenly consider duplicate constraints. To verify, join ALL_CONSTRAINTS with ALL_CONS_COLUMNS table to obtain the column names to which the CHECK constraints apply. You could also check the SEARCH_CONDITION column in the ALL_CONSTRAINTS table.
If my assumption is correct, when you attempt to drop a SYS_ constraint which corresponds to a NOT NULL condition, you ask ORACLE to execute the following SQL statement:
ALTER TABLE product MODIFY (<column_name> NULL), which it will not do (looks like ORACLE does not consider these as actual constraints).
As an exercise, make the NOT NULL columns in the PRODUCT table NULL and query the ALL_CONSTRAINTS table to see if the SYS_ constraints are still there.
I hope this helps.
Michael Serbanescu