Trigger Question

From: The Magnet <art_at_unsu.com>
Date: Mon, 11 Oct 2010 11:49:53 -0700 (PDT)
Message-ID: <2153388f-6c6f-4110-957b-89108c94e969_at_28g2000yqm.googlegroups.com>



Hi,

We are running 10gR2.

We have a strange issue with our triggers, and it is probably something we are missing. We have a table which has a BEFORE UPDATE FOR EACH FOR on it and also an AFTER UPDATE table level trigger on it.

In order to help us debug it we have written out files during the execution of the trigger. These files are the very first thing done. You can see the declarations below.

When we run an update statement from SQLPLUS the triggers act normal and output those files. But, when run through the application, the BEFORE trigger does not put out any files but the AFTER trigger does, which is causing issues.

How can an AFTER trigger fire without firing the BEFORE trigger? What are we missing?

CREATE OR REPLACE TRIGGER ENGINE.order_line_bu_trg BEFORE UPDATE ON ENGINE.ORDER_LINE FOR EACH ROW DECLARE v_file1 UTL_FILE.FILE_TYPE;

BEGIN
   v_file1 := OPEN_FILES('/tmp','before_update.txt','w');    UTL_FILE.PUT_LINE(v_file1,'ORDER: ' || :NEW.order_id);    UTL_FILE.FCLOSE(v_file1);
   order_suspension.save_order_id := :NEW.order_id;


CREATE OR REPLACE TRIGGER ENGINE.order_line_au_trg AFTER UPDATE ON ENGINE.ORDER_LINE
DECLARE v_file2 UTL_FILE.FILE_TYPE;

BEGIN
  v_file2 := OPEN_FILES('/tmp','after_update.txt','w');    UTL_FILE.PUT_LINE(v_file2,'CUSTOMER: ' || order_suspension.save_order_id );

   UTL_FILE.FCLOSE(v_file2); Received on Mon Oct 11 2010 - 13:49:53 CDT

Original text of this message