Wednesday 12 October 2011

Different StatesAttributes of Constraints

{\rtf1\ansi\ansicpg1252\deff0\deflang16393{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fswiss\fprq2\fcharset128 Arial Unicode MS;}{\f2\fnil\fcharset0 Calibri;}}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\lang1033\f0\fs22\par
\pard\li720 A constraint is \b deferred\b0 if the system checks that it is satisfied only on commit. If a deferred constraint is violated, then commit causes the transaction to roll back.\par
If a constraint is \b immediate\b0 (not deferred), then it is checked at the end of each statement. If it is violated, the statement is rolled back immediately. \par
Constraints can be defined as either \b deferrable\b0 or \b not deferrable\b0 , and either \b initially deferred\b0 or \b initially immediate\b0 . These attributes can be different for each constraint. Constraints can be added, dropped, enabled, disabled, or validated. You can also modify a constraint's attributes.\par
\pard\fi360\li360\sb120\sa100\b Constraint States\f1\par
\pard\fi-360\li720\sb120\sa100\tx720\b0\f0 ENABLE ensures that all incoming data conforms to the constraint \par
DISABLE allows incoming data, regardless of whether it conforms to the constraint \par
VALIDATE ensures that existing data conforms to the constraint \par
NOVALIDATE means that some existing data may not conform to the constraint \par
ENABLE VALIDATE is the same as ENABLE. The constraint is checked and is guaranteed to hold for all rows. If a constraint is in this state, then all data in the table is guaranteed to adhere to the constraint. In addition, this state prevents any invalid data from being entered. This is the normal state of operation of a constraint for online transaction processing.\par
ENABLE NOVALIDATE means that the constraint is checked, but it does not have to be true for all rows. This allows existing rows to violate the constraint, while ensuring that all new or modified rows are valid. If a constraint is in this state, the new data that violates the constraint cannot be entered. However the table can contain data that is invalid - that is, data that violates the constraint. This is usually an intermediate stage that ensures that all new data is checked before being accepted into the table. \par
DISABLE NOVALIDATE is the same as DISABLE. The constraint is not checked and is not necessarily true. A constraint that is disabled no validate is not checked, even though the constraint definition is still stored in the data dictionary. Data in the table, as well as the new data that is entered or updated, may not conform to the rules defined by the constraint. This is the normal state of operation of a constraint for online transaction processing.\par
DISABLE VALIDATE disables the constraint, drops the index on the constraint, and disallows any modification of the constrained columns. If the constraint is in this state, them any modification of the constrained columns is not allowed. In addition, the index on the constraint is dropped and the constraint is disabled.\par
\pard\sa200\sl276\slmult1\lang9\f2\par
}

No comments:

Post a Comment