我正在尝试编写一个触发器来更新相同的表数据:
表名:TEST_INSERTTIMETRIGGER
专栏:已更改
以下是我试过的内容:
CREATE OR REPLACE TRIGGER TESTTRIGGER
BEFORE
INSERT ON TEST_INSERTTIMETRIGGER
REFERENCING NEW AS NEW OLD AS OLD
for each row
declare
reqdate date=old.changedate;
BEGIN
:new.changedate:=reqdate+1/24;
END;
当我尝试使用insert语句时,空值将插入到tablename中。
insert into TEST_INSERTTIMETRIGGER (changedate) VALUES (to_date(SYSDATE, 'yyyy/mm/dd hh24:mi:ss'))
让我建议我哪里出错了。
答案 0 :(得分:3)
new.changedate
:
CREATE OR REPLACE TRIGGER TESTTRIGGER
BEFORE
INSERT ON TEST_INSERTTIMETRIGGER
REFERENCING NEW AS NEW OLD AS OLD
for each row
BEGIN
:new.changedate:=:new.changedate + 1/24;
END;