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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-10-16 11:00:00 +0000
Seen: 9 times
Last updated: Nov 28 '21
Is it possible to launch multiple instances of PostgreSQL using Spring Boot Testcontainers?
How to eliminate null values when grouping data in DB2?
What does the DB2 Trigger do following an insertion?
How can I link to two distinct MongoDB databases in my Nuxt 3/ Vue 3 application?
What does @mock_dynamodb2 do with table context?
How can I change the database connection within an interceptor in NestJS using Sequelize-Typescript?
What is the driver for DB2 that uses the R2DBC protocol?
How can SQLAlchemy be used to establish a connection with an IBM DB2 database?