Example 1: Using the SET statement to change the current setting
for constraint evaluation
The following example shows how to use the SET statement
to change the constraint evaluation mode for the current
transaction. You can display both the current setting and the
default setting.
SQL> attach 'filename mf_personnel_sql';
SQL> /*
***> Show settings before starting, set the default mode,
***> then show the settings again.
***> */
SQL> show constraint mode;
Statement constraint evaluation default is DEFERRED (off)
SQL> set default constraint mode immediate;
SQL> show constraint mode;
Statement constraint evaluation default is IMMEDIATE (on)
SQL> start transaction;
SQL> set all constraints deferred;
SQL> show constraint mode;
Statement constraint evaluation default is IMMEDIATE (on)
Statement constraint evaluation is DEFERRED (off)
SQL> commit;
SQL> show constraint mode;
Statement constraint evaluation default is IMMEDIATE (on)
SQL>
Example 2: Using runtime options
If using runtime-options the passed character value must be one
of the keywords: ON, OFF, IMMEDIATE, DEFERRED, or DEFAULT. The
following example shows how this can be done in Interactive SQL.
SQL> show constraint mode
Statement constraint evaluation default is DEFERRED (off)
SQL> declare :c_mode char(10) = 'IMMEDIATE';
SQL> set default constraint mode :c_mode;
SQL> show constraint mode
Statement constraint evaluation default is IMMEDIATE (on)
SQL>