Home > Net >  HANDLER FOR SQLEXCEPTION in my sql procedure
HANDLER FOR SQLEXCEPTION in my sql procedure

Time:12-02

I have provided the given exception handler for handling exception in my sql is given below,

DECLARE CONTINUE HANDLER FOR 1091 SELECT 'SQLException encountered' Message;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'SQLException encountered1' Message;

if exception happened, then 'SQLException encountered', 'SQLException encountered1' printed in procedure output. i need to hide these messages. this is calling procedure, not necessary.

i have tried with the below solution.

    DECLARE CONTINUE HANDLER FOR 1091;
    DECLARE CONTINUE HANDLER FOR SQLEXCEPTION;

but getting error =>

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION;

How can i fix this issue

CodePudding user response:

The Reference Manual explicitly tells how to declare "empty" condition handler:

To ignore a condition, declare a CONTINUE handler for it and associate it with an empty block. For example:

DECLARE CONTINUE HANDLER FOR SQLWARNING BEGIN END;
  • Related