sql - Trigger to update same table data -


i trying write trigger update same table data:

tablename:test_inserttimetrigger

column:changedate

below had tried:

create or replace trigger testtrigger  before insert on test_inserttimetrigger  referencing new  new old old each row declare reqdate date=old.changedate; begin  :new.changedate:=reqdate+1/24;  end; 

null values inserting tablename when tried insert statement.

insert test_inserttimetrigger (changedate) values (to_date(sysdate, 'yyyy/mm/dd hh24:mi:ss')) 

let me suggest going wrong.

the "old" values set null in befor insert trigger. have use new.changedate :

create or replace trigger testtrigger  before insert on test_inserttimetrigger  referencing new  new old old each row begin  :new.changedate:=:new.changedate + 1/24;  end; 

Comments