Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to create a DB2 trigger that will update only one column of the updated row in the same table after an update. Here's an example of the trigger:

CREATE TRIGGER update_column
AFTER UPDATE ON your_table
REFERENCING NEW AS n
FOR EACH ROW
BEGIN ATOMIC
    UPDATE your_table
    SET column_name = n.column_name
    WHERE primary_key = n.primary_key;
END

In this example, replace your_table with the name of your table and column_name with the name of the column you want to update. The trigger will only update the specified column for the row that was updated.