Start of change

-20478   THE STATEMENT CANNOT BE PROCESSED BECAUSE COLUMN MASK mask-name (DEFINED FOR COLUMN column-name) EXISTS AND THE COLUMN MASK CANNOT BE APPLIED OR THE DEFINITION OF THE MASK CONFLICTS WITH THE REQUESTED STATEMENT. REASON CODE reason-code.

Explanation

The statement could not be processed because of a conflict with a column mask that is defined on a column.

mask-name
The name of the column mask.
column-name
The name of the column.
reason-code
The reason for the message or SQL code, indicated by one of the following values:
1
The result table of the select is derived from a set operation that involves one of the following set operators:
  • UNION ALL
  • UNION DISTINCT
  • EXCEPT ALL
  • EXCEPT DISTINCT
  • INTERSECT ALL
  • INTERSECT DISTINCT
2
The column is referenced in the select list of the scalar fullselect and the result of the scalar fullselect expression is derived from a set operation.
3
The column is also referenced in a grouping expression of the GROUP BY clause.
4
When a table contains a column that has a column mask defined on it, each column that is in the table must be referenced as a simple column reference in the GROUP BY clause. Such columns must not be referenced in a grouping expression in the GROUP BY clause.
5
The select list includes an aggregate function and the column that is identified by column-name is specified as an input argument to the function. In this case, the column mask must not reference a scalar fullselect or an aggregate function.
6
A column in the select list maps directly or indirectly to the column column-name of a table expression, view, or common table expression. Such a column must be referenced only as an argument to an aggregate function in the select list.
20
The result table is derived from a recursive common table expression and the column is specified in the fullselect of the recursive common table expression.
21
A column in the select list is an INCLUDE column for a data change statement that is derived from the column for which the mask is defined. The column mask cannot be applied in this context.
22
The result table is derived from a table function and the column was specified as an input argument to the table function.
23
A column in the select list is derived from an OLAP specification and the column is referenced in the partitioning expression or sort key expression of the OLAP specification.
24
The column is referenced in a WHEN clause of a CASE expression.
26
The column is referenced in an aggregate function with keyword DISTINCT.
30
An insert or update operation uses a masked value that is returned from the mask and column that are identified in the message, and the expression that is specified in the THEN or ELSE clause of the column mask definition is not a simple reference to the column.

When the object table is column access control activated, for an insert or update operation, the return expression in the column mask definition must be a simple reference to the column for which the mask is defined.

System action

The statement cannot be processed.

Programmer response

Take the action that corresponds to the reason-code value, and reissue the statement.

1
Either do not reference the column in the select list or do not use the set operation in this context.
2
Either do not reference the column in the select list of the scalar-fullselect expression or do not use a set operator to derive the result of the scalar-fullselect expression in this context.
3
Either do not reference the column in the select list or do not reference the column in an expression in the GROUP BY clause.
4
Either do not reference the column in the select list or change the GROUP BY clause to include only a simple column reference for each column of the same table that is referenced in the mask-name mask.
5
Either do not reference the column in the select list or do not specify the column as an argument to the aggregate function.
6
Either change the query to specify the column as an argument to an aggregate function or remove the GROUP BY clause.
20
Either remove the reference to the column of the recursive common table expression from the select list or do not use the recursive common table expression in this context.
21
Either remove the INCLUDE column from the select list or do not derive the INCLUDE column from the column name.
22
Either do not reference the table function or do not specify the column as input to the table function.
23
Either do not reference the column in the OLAP expression or do not use the OLAP expression in this context.
24
Either change the query to remove the reference to the column in the CASE expression or do not reference the CASE expression in this context.
26
Either remove the reference to the column from the definition of the aggregate function or do not specify the DISTINCT clause in this context.
30
Either change the statement to remove the reference to the column in the insert or update operation, or contact the security administrator to ask them to deactivate the column access control from the object table or modify the return expression in the column mask definition.

SQLSTATE

428HD

End of change