Overriding system generation of column values
Most columns that are defined to have system generated values assigned to them do not allow a user to bypass the generation of the values by the database. Only ROWID, identity, and row change timestamp columns can have their system values overridden by the OVERRIDING SYSTEM VALUES clause on an INSERT, UPDATE, or MERGE statement.
The REPLICATION_OVERRIDE global variable is an alternative to the OVERRIDING SYSTEM VALUES clause, and it applies to all generated columns.
In situations where existing row images need to be kept intact, the use of the REPLICATION_OVERRIDE global variable results in a behavior change for the current session. When REPLICATION_OVERRIDE is set to 'Y', subsequent INSERT, UPDATE, and MERGE statements within that session will be completed without changing the user-supplied values for the system generated columns.
The REPLICATION_OVERRIDE global variable can only be modified by a user who is authorized to the QIBM_DB_GENCOL_OVERRIDE function usage identifier.
When using REPLICATION_OVERRIDE, values for all generated columns must be supplied when inserting a new row.
SET QSYS2.REPLICATION_OVERRIDE ='Y';
Once the global variable is set, an INSERT statement executed in the same session results in the column values from STAGING_TABLE being used as-is, including generated columns.
INSERT INTO PRODUCTION_TABLE
SELECT * FROM STAGING_TABLE;
Since the typical use of REPLICATION_OVERRIDE is for data model administration and change management, the use of REPLICATION_OVERRIDE also prevents generation of system period temporal table history for an update operation.
