Reputation: 1
I am writing some triggers for our DB2 database tables, but I don't have rights to test them...I know...but just a quick question here. Does the NEW and OLD keywords give you the whole row that was updated or just the certain fields that were updated? For example, if I have a table where 1 row just got updated and, only 2 fields in that row got updated/changed do I still get the whole row to work with when I use the NEW keyword? That was my understanding, that even though other fields got updated and others didn't, that I could still refer to any field/value of the entire row using the NEW keyword.
Some illustration here:
Table row:
|first_name | last_name | age | gender | state | city |
|"Tom" | "Sawyer" | 80 | "male" | "California" | "Sacramento"|
Update to same table row:
|first_name | last_name | age | gender | state | city |
|"John" | "Doe" | 80 | "male" | "California" | "Sacramento"|
After the update do I still get the age, gender, state, and city field values using the NEW keyword? As in NEW.age = 80, NEW.state = "California" etc.
or does it only give me the first and last name because they were the only fields to change?
Upvotes: 0
Views: 84
Reputation: 23783
Yes, you can access all the columns in the row with the NEW
correlation.
Upvotes: 1