PLS-00103:期待时遇到符号“)”

时间:2014-06-03 23:39:45

标签: oracle triggers

我在创建以下触发器时遇到以下错误。如何解决错误?请..

  

第6行出错:PLS-00103:遇到符号")"当期待以下之一时:       (如果循环mod,则开始为goto声明结束异常退出       使用

时,null pragma raise返回选择更新
create or replace trigger totalclaimtrig2
after insert on userinfo
for each row
begin
if (:new.sgaji>'2323.41') and (:new.power>1400)  then
(
:new.jumlah_claim := :new.jarak*0.7;
:new.kelas='A';
)

elsif (:new.sgaji>'2323.41') and (:new.power between 1000 and 1400)  then
(
:new.jumlah_claim := :new.jarak*0.6;
:new.kelas='B';
)

elsif (:new.sgaji>'2323.41') and (:new.power between 500 and 1000)  then
(
:new.jumlah_claim := :new.jarak*0.5;
:new.kelas='C';
)

elsif (:new.sgaji>'2323.41') and (:new.power between 175 and 500)  then
(
:new.jumlah_claim := :new.jarak*0.45;
:new.kelas='D';
)

elsif (:new.sgaji>'2323.41') and (:new.power<175)  then
(
:new.jumlah_claim := :new.jarak*0.4;
:new.kelas='E';
)

end if;
end;​

1 个答案:

答案 0 :(得分:0)

删除所有括号,使用:=代替=进行分配,删除上一个;后的奇怪字符,然后将after insert更改为before insert更改新值。

create or replace trigger totalclaimtrig2
before insert on userinfo
for each row
begin
    if :new.sgaji>'2323.41' and :new.power>1400 then
        :new.jumlah_claim := :new.jarak*0.7;
        :new.kelas:='A';
    elsif :new.sgaji>'2323.41' and :new.power between 1000 and 1400 then
        :new.jumlah_claim := :new.jarak*0.6;
        :new.kelas:='B';
    elsif :new.sgaji>'2323.41' and :new.power between 500 and 1000 then
        :new.jumlah_claim := :new.jarak*0.5;
        :new.kelas:='C';
    elsif :new.sgaji>'2323.41' and :new.power between 175 and 500  then
        :new.jumlah_claim := :new.jarak*0.45;
        :new.kelas:='D';
    elsif :new.sgaji>'2323.41' and :new.power<175 then
        :new.jumlah_claim := :new.jarak*0.4;
        :new.kelas:='E';
    end if;
end;