CURRENT RULES special register
CURRENT RULES specifies whether certain SQL statements are executed in accordance with Db2 rules or the rules of the SQL standard.
The data type of the register is CHAR(3), and the only valid values are 'DB2' and 'STD'.
CURRENT RULES is a register at the database server. If the server is not the local Db2, the initial value of the register is 'DB2'. Otherwise, the initial value is the same as the value of the SQLRULES bind option. The initial value of CURRENT RULES in a user-defined function or stored procedure is inherited according to the rules in Special registers in a user-defined function or a stored procedure.
You can change the value of the register by executing the statement SET CURRENT RULES.
CURRENT RULES affects the statements listed in the following table. The table summarizes when the statements are affected and shows where to find detailed information. CURRENT RULES also affects whether Db2 issues an existence error (SQLCODE -204) or an authorization error (SQLCODE -551) when an object does not exist. For CURRENT RULES 'STD', Db2 issues an authorization error (SQLCODE -551) when an object does not exist instead of the existence error (SQLCODE -204).
Statement | What is affected | Details in topic |
---|---|---|
ALTER TABLE | The following behaviors:
|
ALTER TABLE statement |
CREATE TABLE | The following behaviors:
|
CREATE TABLE statement |
GRANT | Granting privileges to yourself. | GRANT statement |
REVOKE | Revoking privileges from authorization IDs | REVOKE statement |
SET CURRENT RULES = 'STD';