Capture the data while updating a table

Database
Enthusiast

Capture the data while updating a table

Hi all!

I have a sequence of update queries on a very huge table TableA. Now when it updates the table I want to capture all the primary key of the records getting updated. This primary key will then be used to join with TAble B. Can I achieve this in the Update statement itself? I read we have ON UPDATE clause in SQL which can do this. Do we have a similar option in Teradata?

I can create a temp table with the primary key instead of updating the table directly and then use this temp table to update TableA as well as join with TableB. But as I said earlier there are multiple such Update statements. SO I will have to drop and create this table multiple times.
Also, the Update statement updates the Status. And the second Update statement uses this status in TABLEA to update it. So I have to make sure I update the tableA as well as capture the primary key. I cannot keep inserting records in the temp table and then in the end Update the TableA.
Any help is appreciated!

3 REPLIES
Enthusiast

Re: Capture the data while updating a table

Anyobody with any suggestions?
BTW, we are not allowed to use a trigger or stored procedure.
Teradata Employee

Re: Capture the data while updating a table

Hi,

Triggers would be your best bet .... but as you mentioned you are not allowed to use them .... can you share some UPDATE statements to clear the overall picture?

Regards,

MAC
Enthusiast

Re: Capture the data while updating a table

Thanks for ur reply!
I have added a flag which I will be setting whenever a record gets updated. In this way after all updates, I can use the flag to find the updated records.