create trigger booking_trigger
before insert on booking
for each row
WHEN (new.booking_id IS NULL)
begin
if sys_date > paid_date and ammount>0 =:new.'Paid' from dual;
elsif sys_date > paid_date and ammount=0 =:new.'Not paid' from dual;
elsif sys_date < paid_date and ammount=0 =:new.'Waiting';
else :=new.'Broken'
end if;
end
/
答案 0 :(得分:1)
让我们从IF THEN ELSIF开始吧。显然,缺少关键字then
。
您希望更新哪一列?我们说它是a_column
。在这种情况下,您将其值设置为'Paid'
,如下所示:
:new.a_column := 'Paid';
您可以阅读有关触发器in the documentation
的更多信息