I am currently working on registration errors in the procedure. The purpose of this procedure is to call exception handlers in other packages in the database and register errors that each program encounters. below is my code.
CREATE OR REPLACE PROCEDURE APMS.test_procedure AS procedure write_error_log (errcode number, errstr varchar2) is pragma autonomous_transaction; -- this procedure stays in its own new private transaction begin INSERT INTO error_log (ora_err_tmsp, ora_err_number, ora_err_msg, ora_err_line_no) values (CURRENT_TIMESTAMP, errcode, errstr, 'line number'); COMMIT; -- this commit does not interfere with the caller transaction. end write_error_log; BEGIN INSERT INTO mockdata VALUES ('data1', 'mockname', 'mockcity'); exception when others then write_error_log(sqlcode,sqlerrm); raise; END test_procedure; /
Currently, I just throw an error in my mock_data table to log an error in the error_log table and see if its functionality is working, how to determine the row number column number. I am a complete newbie, so any help would be appreciated. If anyone knows how I could use this procedure in other packages / procedures to register errors in other packages, which would also be awesome. I am here to find out that any feedback is welcome, I can expand this post even more if I am not clear.
Jules source share