在“ =”之前插入符号“ *”以继续

时间:2018-11-19 08:24:03

标签: oracle database-trigger

create or replace trigger check_status BEFORE update on LDS_PLACEMENT
for each row declare STATUS LDS_PLACEMENT.STATUS%type;
begin
STATUS :=old.STATUS;
if STATUS := 'Closed' then
raise_application_error(-20111,'Sorry the placement is closed');
end if;
end;

第5行出现错误。代码未编译。

这是一项学术任务。

1 个答案:

答案 0 :(得分:1)

从if语句的等式中删除:

:=表示您的分配值就像您在old.status

中所做的一样
create or replace trigger check_status BEFORE update on LDS_PLACEMENT
for each row declare STATUS LDS_PLACEMENT.STATUS%type;
begin
STATUS := :old.STATUS;

if STATUS = 'Closed' then
raise_application_error(-20111,'Sorry the placement is closed');
end if;
end;