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_APPLICATI ON_ERROR(-20001, 'Problem here. . .');
dbms_job.submit (test_job,'inse rt into MYTABLE (COL1, COL2)
values ('THIS WAS', 'AN ERROR'); commit;', NULL);
dbms_job.run(te st_job, false);
END IF;
END;
/
Thanks.
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_APPLICATI ON_ERROR(-20001, 'Problem here. . .');
dbms_job.submit (test_job,'inse rt into MYTABLE (COL1, COL2)
values ('THIS WAS', 'AN ERROR'); commit;', NULL);
dbms_job.run(te st_job, false);
END IF;
END;
/
Thanks.
Comment