Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a columns value was explicitly specified in a PL/SQL BEFORE UPDATE trigger?

Is there a way to tell which columns were explicitly updated in a PL/SQL BEFORE UPDATE trigger?

For example: I want to set :new.last_modified_by := USER only if the UPDATE statement did not explicitly specify a value for this column.

like image 822
shindigo Avatar asked Dec 26 '22 06:12

shindigo


1 Answers

Use the UPDATING function:

if updating('LAST_MODIFIED_BY') then 
...
end if;

More details are in the manual: http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#BCFIDDBB

like image 120
a_horse_with_no_name Avatar answered Jan 04 '23 23:01

a_horse_with_no_name