You have not described your requirements in great detail. Here is a simple error log table and error reporting procedure:
CREATE TABLE error_log (ts TIMESTAMP NOT NULL, msg VARCHAR2(4000));
CREATE PROCEDURE log_error (msg IN VARCHAR2) IS
BEGIN
INSERT INTO error_log (ts, msg)
VALUES (SYSTIMESTAMP, SUBSTR(insert_log.msg, 1, 4000));
END log_error;
You might need an offline transaction. This will depend on whether you want the log to record errors from procedures that cancel their changes.
As a rule, this will be implemented in a more general logging system, which will record not only errors, but also warnings and debugging information.
, DML (insert/update/delete) ( , ), LOG ERRORS, , , , //, . . , vettipayyan.
, , WHEN OTHERS:
BEGIN
EXCEPTION
WHEN OTHERS THEN
log_error(DBMS_UTILITY.format_error_stack);
log_error(DBMS_UTILITY.format_error_backtrace);
RAISE;
END;