DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: pls help me create 2 triggers

  1. #1
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586

    pls help me create 2 triggers

    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;
    /
    "High Salaries = Happiness = Project Success."

  2. #2
    Join Date
    Oct 2002
    Posts
    182
    couldn't tell if you wanted an after update or after insert.
    I think you want after update
    PHP Code:
    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
    Last edited by Cookies; 09-03-2004 at 03:22 PM.
    - Cookies

  3. #3
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586

    to cookies:

    cookies:

    thanks for your help
    "High Salaries = Happiness = Project Success."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width