CREATE TABLE error_table (v_error_code NUMBER,v_error_desc VARCHAR2(300));

DECLARE
v_error_desc VARCHAR2 (300);
v_error_code NUMBER;
BEGIN
FOR errno IN REVERSE -32799 .. 0
LOOP
v_error_code := errno;
v_error_desc := SQLERRM (errno);

IF v_error_desc NOT LIKE ‘%Message % not found;%’
AND v_error_desc != ‘ORA’ || TO_CHAR (errno, ‘FM09999’) || ‘: ‘
THEN
INSERT INTO error_tablom
VALUES (v_error_code, v_error_desc);

COMMIT;
END IF;
END LOOP;
END;
/