Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

HANDLER FOR SQLEXCEPTION in my sql procedure

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

    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

>Solution :

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;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading