Quantcast
Channel: EasyOraDBA
Viewing all articles
Browse latest Browse all 263

Trigger on Change of Column Value in Oracle

$
0
0

Suppose you need to fire a trigger based on the change of value of a column and then perform some action based on it. You can do it easily like the below.


CREATE OR REPLACE TRIGGER TEST_TRIGGER
after UPDATE of COLUMNName ON TABLENAME1
for each row
WHEN (
NEW.COLUMNName= '0' and NEW.COLUMNName2='1'
)
BEGIN
if :new.COLUMNName= '0'  and :new.COLUMNName2='1' then
update tablename2 set columname3= '2';
end if;
END;
/


Viewing all articles
Browse latest Browse all 263

Trending Articles