SQL20478 error when you run a query
If a data masking rule applies to TableA and you run a query that uses CREATE
TABLE ... AS SELECT ... FROM TableA
, you might see an error message with Reason code
"30". SQLCODE=-20478, SQLSTATE=428HD.
Symptoms
This error occurs because by default, masked data cannot be written to tables or transition-variables. For example, you might see the following error message.
The statement failed because the column mask "EXTERNAL.Transform" defined for column
"SCHEMA.TABLE_NAME.COLUMN" exists and the column mask cannot be applied or the column mask
conflicts with the failed statement. Reason code "30". SQLCODE=-20478, SQLSTATE=428HD
Resolving the problem
To allow writing of masked data, set the
DB2_ALLOW_WRITE_OF_MASKED_DATA registry variable to
YES
.- Log in to the Data
Virtualization head pod.
oc rsh c-db2u-dv-db2u-0 bash
- Switch to the Data
Virtualization database instance owner
db2inst1
.su - db2inst1
- Test the connection to the Big SQL
database.
db2 connect to bigsql
- Set the DB2_ALLOW_WRITE_OF_MASKED_DATA registry variable to
YES
.db2set DB2_ALLOW_WRITE_OF_MASKED_DATA=yes -immediate
Changes to this variable can take effect immediately for all future compiled SQL statements if the db2set command is issued with the -immediate parameter. You do not need to restart the instance.