user3673018
user3673018

Reputation: 3

PLS-00103: Encountered the symbol ")" when expecting

i'd encountered following error when creating the following trigger. How to resolve the error? Please..

Error at line 6: PLS-00103: Encountered the symbol ")" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with

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;​

Upvotes: 0

Views: 1250

Answers (1)

Jon Heller
Jon Heller

Reputation: 36922

Remove all parentheses, use := instead of = for assignments, remove the weird character after the last ;, and change after insert to before insert to change the NEW values.

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;

Upvotes: 0

Related Questions