I am trying to create an archive in the following way. Created a replica of the table I want to archive from and added a column named DATA\_PERIOD. My idea is to create a trigger that after this table is inserted with data from the original table, the DATA\_PERIOD is updated with the current\_timestamp. Here is the code I worte.

```
CREATE TRIGGER ORDERS_SUMMARY_ARCHIVE
AFTER INSERT ON GDTS.ORDERS_SUMMARY_A
FOR EACH ROW
WHEN (DATA_PERIOD IS NULL)
UPDATE GDTS.ORDERS_SUMMARY_A SET DATA_PERIOD = CURRENT_TIMESTAMP

```

So when the table is populated, the timestamp is inserted. 

Not sure if there is a better way to do this. I've found that statement in a knowledge book and tried to adapt it to my needs, but without success.

> 
> "DATA\_PERIOD" is not valid in the context where it is used.. SQLCODE=-206, SQLSTATE=42703, DRIVER=3.68.61
> 
> 
> 

Do I need some kind of reference to the table in the condition?

Thanks