注册

DM7触发器出现编译错误,无法解决

陈菠萝 2023/12/02 532 2 已解决

DM7触发器出现编译错误,无法解决
【DM版本】:DM7
【操作系统】:WIN11
【CPU】:I5-12500H
【问题描述】:改了好几次,始终没发现语法错误,不知道为什么编译不了。代码如下:

create or replace trigger CHENYZ.TRG_PROJECT_STATUS before insert or update on CHENYZ.PROJECT_STATUS for each row declare unstart exception for -50001, '未开始,开始和结束时间应为空'; working exception for -50002, '进行中,开始时间不能为空,结束时间应为空'; complt exception for -50003, '已完成,开始和结束时间不能为空'; begin case :new."STATUS" when '未开始' then if :new."COMPLETIONDATE" is not NULL or :new."STARTDATE" is not NULL then raise unstart; end if; when '进行中' then if :new."STARTDATE" is NULL or :new."COMPLETIONDATE" is not NULL then raise working; end if; when '已完成' then if :new."STARTDATE" is NULL or :new."COMPLETIONDATE" is NULL then raise complt; end if; end case; end;

还有另外一个代码同样报错:

create or replace trigger CHENYZ.TRG_PROJECT_STATUS before insert or update on CHENYZ.PROJECT_STATUS for each row declare unstart exception for -30001;--, '未开始,开始和结束时间应为空'; working exception for -30002;--, '进行中,开始时间不能为空,结束时间应为空'; complt exception for -30003;--, '已完成,开始和结束时间不能为空'; begin if :new."STATUS" = '未开始' then if (:new."COMPLETIONDATE" is not NULL or :new."STARTDATE" is not NULL) then raise unstart; end if; elsif :new."STATUS" = '进行中' then if (:new."STARTDATE" is NULL or :new."COMPLETIONDATE" is not NULL) then raise working; end if; else if (:new."STARTDATE" is NULL or :new."COMPLETIONDATE" is NULL) then raise complt; end if; end if; end;

错误截图如下:
image.png

回答 0
暂无回答
扫一扫
联系客服