Manipulating data in a system-period temporal table

You can do update, insert, delete, and merge operations on a system-period temporal table.

Before you begin

Before you do any of these operations on a system-period temporal table, if your application is bound with SYSTIMESENSITIVE YES, make sure that the CURRENT TEMPORAL SYSTEM_TIME special register is null. Otherwise, if a value is in effect for this special register, update, insert, delete, and merge operations on system-period temporal tables are blocked.

Procedure

To manipulate data in a system-period temporal table:

Issue INSERT, UPDATE, DELETE, or MERGE statements to make the changes that you want.
Timestamp information is stored in the timestamp columns, and historical rows are moved to the history table.
Restriction: You cannot issue SELECT FROM DELETE or SELECT FROM UPDATE statements when the FOR PORTION OF option is specified for either the UPDATE statement or the DELETE statement. Db2 issues an error in both of these cases (SQL error code -104 with SQLSTATE 20522).

Example

Begin general-use programming interface information.

The following example shows how you can insert data in the POLICY_INFO table by specifying the DEFAULT keyword in the VALUES clause for each of the generated columns:

INSERT INTO POLICY_INFO   
VALUES ('A123', 12000, DEFAULT, DEFAULT, DEFAULT);
End general-use programming interface information.