PURUSH, May 23, 2001 - 5:23 am UTC
Baisc funda but very useful
Changing NON-DEFERRABLE/DEFERRABLE "type" of constraints
Michal, March 09, 2004 - 4:47 pm UTC
Does it mean that once you created a constraint NON-deferrable you have bad luck and you cannot do such a processing (allow a temporary inconsistant state)?
Indeed, yes it does as I looked it up within Oracle documentation:
------------------
DEFERRABLE Clause
The DEFERRABLE and NOT DEFERRABLE parameters indicate whether or not, in subsequent transactions, constraint checking can be deferred until the end of the transaction using the SET CONSTRAINT(S) statement. If you omit this clause, then the default is NOT DEFERRABLE.
Specify NOT DEFERRABLE to indicate that in subsequent transactions you cannot use the SET CONSTRAINT[S] clause to defer checking of this constraint until the transaction is committed. The checking of a NOT DEFERRABLE constraint can never be deferred to the end of the transaction.
Specify DEFERRABLE to indicate that in subsequent transactions you can use the SET CONSTRAINT[S] clause to defer checking of this constraint until after the transaction is committed. This setting in effect lets you disable the constraint temporarily while making changes to the database that might violate the constraint until all the changes are complete.
You cannot alter a constraint's deferrability. That is, whether you specify either of these parameters, or make the constraint NOT DEFERRABLE implicitly by specifying neither of them, you cannot specify this clause in an ALTER TABLE statement. You must drop the constraint and re-create it.
------------------