i am new to writing sql statements. I am trying to write a trigger on a table after insert. The original functionality of the trigger is very lengthy. However just at the beginning i am getting compilation error for invalid sql statement. the code segment is mentioned below drop trigger bill_update;
create or replace trigger bill_update
after insert on SingleFoodOrder
for each row
declare
f_price number;
old_bill number;
f_quantity number;
p_bill number;
foodID number;
orderID number;
order_date Date;
s_date Date;
f_date Date;
f_dis number;
a number;
b number;
c number;
BEGIN
if :new.Order_ID is not NULL THEN
foodID := :new.Fooditem_ID;
orderID := :new.Order_ID;
f_quantity := :new.Quantity;
end if;
end;
/
This code is for the simplicity's sake for the error. If i remove the if,end if part then it compiles with no error. But adding the if part gives the error. I have order_id collumn in the singlefoodorder table which can be set to null just to make clear. Where is the problem?
Aucun commentaire:
Enregistrer un commentaire