Previous Topic Next topic Print topic


SET CURRENT RULES

The SET CURRENT RULES statement assigns a value to the CURRENT RULES special register.
Restriction: This topic applies to Windows environments only.

Invocation

SET CURRENT RULES is an executable command that can be issued interactively, embedded in a host language, or dynamically prepared.

Authorization

None required.

Syntax

SET CURRENT RULES = {'DB2' | 'STD' | host-variable}

Parameters:

DB2 Causes commands to execute according to DB2 rules.
STD Causes commands to execute according to ANSI/ISO rules.
host-variable Names a host variable (character string not longer than eight bytes) containing the value to be assigned to the special register CURRENT RULES. The value must be either 'DB2' or 'STD', and must be a character string three bytes in length.

Description

This statement replaces the value of the CURRENT RULES special register with the value of the string constant or host variable. The functionality of this command is identical to the XDB Server command SET COMPATIBILITY. One particular application of this special register value is that it controls the way table check constraints are enforced. The contents of CURRENT RULES chooses one of two distinct SQL rules that will apply to already populated tables containing check constraints. If the value is STD, a check constraint is enforced as soon as it is defined. If a row does not conform, the table check constraint is not added to the table and an error occurs. If the value is DB2, the check constraint is added to the table description but its enforcement is deferred. Because there might be rows in the table that violate the check constraint, the table is placed in check pending status.

Example:

The example below sets the CURRENT RULES special register to a value of DB2.

SET CURRENT RULES = 'DB2'
Previous Topic Next topic Print topic