Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Please help with this trigger

Please help with this trigger

From: Andy <abruskoNOabSPAM_at_binney-smith.com.invalid>
Date: Tue, 16 Nov 1999 04:48:59 -0800
Message-ID: <1415c574.fee33839@usw-ex0102-015.remarq.com>


Hi,

I am trying to create a trigger that will keep 2 tables in sync. I have a master table that is maintenanced (added, changed or deleted) and I would like to keep a smaller version of that table in sync with it. If a row is added to the master, I would like to add a row to the other table, if one is deleted from the master, I would like to delete the same row from the other and any changes to the master, I would like to apply (if the same column exists) to the other table.

Below is what I have written so far, but it is obviously not correct. Can someone please show me what I need to change so that it works correctly...I appreciate it...thanks!!! Andy

create or replace trigger update_supplier before insert or delete or update on frt.supplier_master for each row
begin
  if inserting then

     insert into frt.supplier (abv, supplier, customer, code, division)
        values (:new.abv, :new.customer_vendor, :new.customer_vendor_no,
                :new.code, :new.division);
  elsif deleting then
     delete from frt.supplier where abv = :new.abv;
  elsif updating then
     update frt.supplier set abv = :new.abv, supplier =
:new.customer_vendor,
        customer = :new.customer_vendor_no, code = :new.code, division
= :new.division;
  end if;
end; Received on Tue Nov 16 1999 - 06:48:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US