Oracle trigger – update column on newly inserted record

In My Oracle (Express) DB I have a table with a column, named created(date type).
What I am trying to do, is to create a trigger that will update that column after an update or insert, was done, with SYSDATE.

My sql (for insert only, I know, it fails anyway) is:

CREATE OR REPLACE TRIGGER  "VIRTUAL_COUNTERS_NEW" 
AFTER
insert on "VIRTUAL_COUNTERS"
begin
new.updated := SYSDATE
end;
/
ALTER TRIGGER  "VIRTUAL_COUNTERS_NEW" ENABLE
/


Source: oracle

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.