6

I'm thinking about porting a database from Sql Server 2005 to MySQL.

I've become accustomed to using SQL Server's TRY/CATCH block in stored procedures.

Does MySQL have something similar, or am I going to be forced to go back to the old-school "check the error return after every statement, and issue a goto if it failed" style of programming?

2 Answers 2

6

You can declare handlers for specific error results.

Sign up to request clarification or add additional context in comments.

Comments

0

There is no try/catch in MySQL as far as i know. Here something that can help with the errors in stored procedures:

DECLARE EXIT HANDLER FOR SQLEXCEPTION SELECT 'SQLException invoked';

Source:http://www.mysqltutorial.org/mysql-error-handling-in-stored-procedures/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.