Re: Inserting errors into logs
Minimally...
CREATE PROCEDURE errdemo( pvalue INT, OUT pResult INT )
BEGIN
DECLARE bad_key CONDITION FOR SQLSTATE '23000';
DECLARE EXIT HANDLER FOR bad_key
BEGIN
INSERT INTO errlog
SET dt=Now(),msg=Concat('Insert on t failed; bad key.');
SET presult=-1;
ROLLBACK;
END;
START TRANSACTION;
INSERT INTO t VALUES( pvalue, NULL ) ;
SET pResult=Row_Count();
COMMIT;
END;
END;
Subject
Views
Written By
Posted
295
April 20, 2020 07:10AM
Re: Inserting errors into logs
127
April 20, 2020 11:29AM
107
April 22, 2020 06:58AM
120
April 22, 2020 02:45PM
96
April 23, 2020 12:38AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.