plsql - After a trigger is executed on one table, is it possible to display the values of a column from another table? (PL/SQL) -
i have trigger execute when table updated. trigger updates table. i'd display changes of second table.
this code have:
create or replace trigger update_club_fee after update of fee on sporting_clubs each row begin update club_membership set amount = (duration*:new.fee) :old.club_id = :new.club_id; dbms_output.put_line('customer id is: '||:new.customer_id); dbms_output.put_line('previous amount '||:old.amount); dbms_output.put_line('new amount '||:new.amount); end;
i don't think trigger appropriate tech solution. ui code captures change club membership should propagate changes child tables , deliver reporting.
but if need use triggers, it's not going possible quite that:
- you cannot reference :old , :new on club_membership - these records relate trigger's owning table (sporting_clubs in case). :old.amount not resolve
- an update on 1 row in sporting_clubs may result in many rows being updated in club_membership (each club has more 1 member, right?). presume want know each row
i write procedure accepts club_id , fee. update related rows in club_membership , report on updated rows. call procedure trigger.
but, please, don't use triggers this.
Comments
Post a Comment