oracle11g - trigger to update value from one table to other -
i'm trying create trigger value of plan_id db table has occured more 3 times , update value of amount regarding plan_id in preplan or postplan tables(wherever plan_id belongs to).
schema tables this:
db table:
 name                                      null?    type  ----------------------------------------- -------- ----------------------------  plan_id                                   not null number  connection_id                             not null number preplan:                          
 name                                      null?    type  ----------------------------------------- -------- ----------------------------  plan_id                                   not null number  amount                                             number postplan:
     name                                      null?    type  ----------------------------------------- -------- ----------------------------  plan_id                                   not null number  amount                                             number i have written following trigger this:
create or replace  trigger plan_discount_trigger  after insert    on db each row declare     l_planid  number(5);    l_amount  number(5);  begin   select plan_id db l_planid group plan_id having count(:new.plan_id)>3;     if (l_planid>0 , l_planid<6)         select amount l_amount preplan;         update preplan set prepaid.amount = l_amount - (l_amount * 0.1);      elsif (l_planid>9 , l_planid<16)         select amount l_amount postplan;         update postplan set postpaid.amount = l_amount - (l_amount * 0.1);   else         dbms_output.put_line("invalid plan!");      end if; end; its giving error:
8/2      pl/sql: sql statement ignored 8/25     pl/sql: ora-00933: sql command not ended just explain me error , how solve it???
this needs changed
 select plan_id db l_planid group plan_id having count(:new.plan_id)>3; to
select plan_id l_planid db  group plan_id having count(plan_id)>3; 
Comments
Post a Comment