Click to See Complete Forum and Search --> : pls help me create 2 triggers


jlakhani
09-03-2004, 03:16 PM
I am a novice at plsql:

can you help me write the following ddl?

creater trigger name qoh_update that is associated with order_line table and correctly adjusts the inv_qoh filed in the invetory_Table whenever the ol_quantity field is updated for associated invetory item..

here is my ddl

create or replace trigger qoh_update
after insert on order_line
for each row
begin
update inventory
--set inv_qoh = ol_quantity;
where inv_qoh =

--where inv_id = :new.inv_id;
end;
/

Cookies
09-03-2004, 04:20 PM
couldn't tell if you wanted an after update or after insert.
I think you want after update

create or replace trigger qoh_update
after update of ol_quantity field on order_line
for each row
begin

update inventory
set inv_qoh = new:ol_quantity;
where inv_id = :old.inv_id;
end

you might want to change the where clause if you want
ALL 'inv_qoh' fields updated. change where clause to:
where inv_qoh = old:ol_quantity

jlakhani
09-09-2004, 12:21 AM
cookies:

thanks for your help