Trigger and DML INSERT on separate table

From: Tom Urbanowicz <tsu_at_landacorp.com>
Date: 9 Jul 2003 15:02:46 -0700
Message-ID: <6d63e629.0307091402.45924bf_at_posting.google.com>


I have a trigger. Each time the triggering event fires, I want to insert some information into another 'audit-like' table (not at all related to the trigger). Some psuedo-code is below as to what I've been working with; I am unable to get the INSERT to work? Recommendations; what am I doing wrong?


CREATE OR REPLACE TRIGGER test
AFTER INSERT OR DELETE OR UPDATE ON testdb FOR EACH ROW
DECLARE
        mytestvar number;

        test_job number;
BEGIN
   IF mytestvar > 0 THEN

       RAISE_APPLICATION_ERROR(-20001, 'Problem here. . .');
       dbms_job.submit(test_job,'insert into MYTABLE (COL1, COL2)
values ('THIS WAS', 'AN ERROR'); commit;', NULL);
       dbms_job.run(test_job, false);

   END IF;
END;
/

Thanks. Received on Thu Jul 10 2003 - 00:02:46 CEST

Original text of this message