Getting Error Message inside a Stored Proc Exception Handler
I'm a core-DBA, not much idea in stored Proc's.
I have written a a SP with Exception CONTINUE HANDLER. My requirement is to get the Error Message from the errors if any. I have written the code as below, please let me know if this is the correct way of capturing the Error Message, or is there a better way of writing ?
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000'
::::some code logic here...
GET DIAGNOSTICS EXCEPTION 1 ErrMsg_value = MESSAGE_TEXT ;
SET ErrCode_value = SQLCODE ;
May be this is simple for you guy's..Thanks in advance.