Hi all,

I write the code below in order to recuperate the error messages in a table(db_errors) I created. But nothing is inserted in the db_errors table even the statements are wrong. Please advice how to use SQLCODE and SQLERRM.
This is executed in SQL*Plus

DECLARE
err_num NUMBER;
err_msg VARCHAR2(100);
BEGIN
INSERT INTO ...
INSERT INTO ...
UPDATE…

EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
err_msg := SUBSTR(SQLERRM(SQLCODE), 1, 250);
INSERT INTO db_errors(err_msg) VALUES (err_msg);
END;
/

Thanks in advance