Skip to content
Advertisement

Automatically updating a field after a manuall update in Oracle SQL

I have a table that has a bunch of columns, one of which is a ‘last_update_time’ column. Whenever I change the value of any of the other columns, I would like ‘last_update_time’ to automatically update to SYSDATE.

I know that you would usually use triggers for this kind of thing, but as far as I am aware it is not possible to have a trigger for a table mutate that same table.

What is the best way of implementing the functionallity described above?

Advertisement

Answer

You can use a trigger before update of. You only need to specify the columns that might be updated in the clause before of

Take a look at this

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement