ALTER MASK statement
The ALTER MASK statement changes a column mask that exists at the current server.
Invocation for ALTER MASK
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared only if DYNAMICRULES RUN behavior is in effect. For more information, see Authorization IDs and dynamic SQL.
Authorization for ALTER MASK
The privilege set that is defined below must include the following authority:
- SECADM authority
Privilege set: If the statement is embedded in an application program, the privilege set is the privileges that are held by the owner of the package. If the statement is dynamically prepared, the privilege set is the union of the privilege sets that are held by each authorization ID and role of the process.
Syntax for ALTER MASK
Description for ALTER MASK
- mask-name
- Identifies the column mask to be altered. The name must identify a mask that exists at the current server.
- ENABLE
- Specifies that the column mask is to be enabled for column access control. If column access
control is not currently activated for the table, the column mask will become effective when column
access control is activated for the table. If column access control is currently activated for the
table, the column mask becomes effective immediately and dynamic cached statements that reference
the table are invalidated.
Use of this clause or keyword might invalidate packages that depend on the target object, or packages that depend on related objects through cascading effects. See Changes that invalidate packages.
A column mask with a regeneration error cannot be enabled. To clear the status of the column mask, the column mask must be dropped and re-created with a modified definition.
ENABLE is ignored if the column mask is already defined as enabled for column access control.
- DISABLE
- Specifies that the column mask is to be disabled for column access control. If column access
control is not currently activated for the table, the column mask will remain ineffective when
column access control is activated for the table. If column access control is currently activated
for the table, the column mask becomes ineffective immediately and all dynamic cached statements
that reference the table are invalidated.
Use of this clause or keyword might invalidate packages that depend on the target object, or packages that depend on related objects through cascading effects. See Changes that invalidate packages.
DISABLE is ignored if the column mask is already defined as disabled for column access control.
- REGENERATE
- Specifies that the column mask is to be regenerated. The column mask definition in the catalog is used, and any existing dependencies and authorization are retained. The column mask definition is reevaluated as if the column mask was being created. The user-defined functions that are referenced in the column mask definition must be resolved to the same secure UDFs as that were resolved during the column mask creation.
Generally, the REGENERATE keyword is used only for specific situations, such as when implicit regeneration fails for routines or objects, or Db2 maintenance requires objects or routines to be regenerated. For more information, see When to regenerate Db2 database objects and routines.
USING APPLICATION COMPATIBILITY applcompat-level
FL 500Specifies that the object is regenerated under applcompat-level application compatibility rules. The ALTER statement fails if it includes any syntax, semantics, or options that require a higher application compatibility level.
If USING APPLICATION COMAPTIBILITY is omitted, the regeneration uses the APPLCOMPAT value of the applicable SYSIBM.SYSENVIRONMENT catalog table row.
The following applcompat-level values can be specified:VvvRrMmmm
Compatibility with the behavior of the identified Db2 function level. For example,
V12R1M510
specifies compatibility with the highest available Db2 12 function level. The equivalent function level or higher must be activated.For the new capabilities that become available in each application compatibility level, see:
- SQL changes in Db2 13 application compatibility levels
- SQL changes in Db2 12 application compatibility levels
Tip:Extra program preparation steps might be required to increase the application compatibility level for applications that use data server clients or drivers to access Db2 for z/OS®. For more information, see Setting application compatibility levels for data server clients and drivers.
V12R1
Compatibility with the behavior of Db2 12 function level 500. This value has the same result as specifying
V12R1M500
.- V11R1
- Compatibility with the behavior of Db2 11 new-function mode. After migration to Db2 12, this value has the same result as specifying
V12R1M100
. For more information, see V11R1 application compatibility level - V10R1
- Compatibility with the behavior of DB2® 10 new-function mode. For more information, see V10R1 application compatibility level.
Notes for ALTER MASK
- Applying Db2 maintenance:
- When Db2 maintenance is applied that
affects how a column mask is generated, the column mask might need to be regenerated to ensure the
column mask is still valid.
If the column mask is regenerated successfully, the status of the column mask is set to a blank in the catalog table. If the column mask is enabled and column access control is currently activated for the table all dynamic cached statements that reference the table are invalidated.
If the column mask cannot be regenerated successfully, an error is returned. The regeneration status of the column mask is an error. If the column mask is enabled and column access control is currently activated for the table, all packages and dynamic cached statements that reference the table are marked invalidated. To clear the status of the column mask, the column mask must be dropped and re-created with a modified definition. Or the column mask can be disabled if not disabled yet. A disabled column mask becomes ineffective to a column access control enforced table.
When the table is referenced in a data manipulation statement, the statement returns an error if any enabled column mask has an regeneration error.
- Invalidation of packages:
- This statement might invalidate all packages that depend on target objects, and sometimes other related objects through cascading effects, depending on the clauses and keywords specified and other factors. For more information, see Changes that invalidate packages.
Examples for ALTER MASK
- Example 1:
- Enable column mask M1.
ALTER MASK M1 ENABLE;
- Example 2:
- Regenerate column mask M1.
ALTER MASK M1 REGENERATE; COMMIT;