'Logging errors in a new table

DECLARE

    v_error_code number;
    v_error_message varchar2(255);
    NO_EDIT STUD.S_NO%TYPE;
BEGIN
    NO_EDIT:=&NO_EDIT;
    DELETE FROM STUD
    WHERE S_NO =NO_EDIT;
    COMMIT;

EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    v_error_code := SQLCODE;
    v_error_message := SQLERRM;
    INSERT INTO errors VALUES (v_error_code, v_error_message);
END;
/

CREATE TABLE ERORRS(
    v_error_code number,
    v_error_message varchar2(255)   
);

Errors in SQL*Plus

ERROR at line 17:
ORA-06550: line 17, column 17:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 17, column 5:
PL/SQL: SQL Statement ignored


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source