Show errors using in procedure

Dear Team,

In the procedure while performing exception handling we need to capture the information that has been returned by the SHOW ERRORS command @the runtime.

Show errors results : LEVEL, CODE and MESSAGE.
Appreciate if I get a way to get the above info in the procedure and insert into our error log table.

I can get the ECHO SELECT @@ERROR_COUNT but not the abovee 3 details.

Thanks

With regards,
Prathap Reddy G

I created a function to capture the data from the Message. Below is how I pull Code and Type information.

lCode INT =REGEXP_SUBSTR(REGEXP_SUBSTR(ExceptionMessage,’\mER_.+ ‘),’[0-9]+’);
lType TINYTEXT =REGEXP_SUBSTR(ExceptionMessage,’\mER_\S+’);

I also remove Code, Type and schema / proc name to cut down on message length in our logging.

(SingleStore already has a open request to allow capturing CODE… at this time I think it’s still on the backlog.)