Link to home
Start Free TrialLog in
Avatar of Robert Silver
Robert SilverFlag for United States of America

asked on

Is there try / catch block capability in MySQL and If so how?

Is there try / catch block capability in MySQL stored procedures and functions and If so how? Any samples??

e.g   Begin Try
          .....
         END TRY
         BEGIN CATCH
           ....  Exception handling code e.g division by 0 or no rows found etc...
         END CATCH


This capability is in Microsoft SQL Server 2008 so Is it also in MySQL 5.6 and if not when will it be MySQL??? Anytime soon?
Avatar of Dushan Silva
Dushan Silva
Flag of Australia image

No, MySQL does not have that functionality.
ASKER CERTIFIED SOLUTION
Avatar of johanntagle
johanntagle
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robert Silver

ASKER

Thank you for that information ,   johanntagle!!
It sounds like try catch blocks need to be introduced to MySQL or MariaDB.
From what I have seen in MySQL there are several areas that could be vastly improved
try/catch with stored procedures is one of the improvements I would like to see in future releases as well as improved constraint handling as is found in the more robust databases.

Thank you for the information about the handler. Most  MySQL server programmers rely on Java try catch blocks but it would stream line the use of stored procedures to use this.

Definitely more work could be done on such important features .