Hi all,

Likewise in SQL Server, after every transaction, an error number is set to the global variable @@ERROR. So we easily make a check in SQL SERVER stored procedure,

IF @@ERROR = 0 
SELECT 'SUCCESS'
ELSE
SELECT 'FAIL'

How can I do the similar thing in MySQL. How can I get the Error number or Error Code in mySQL, so that I can implement the same if check in mySQL Stored Procedure.

Basically I am transforming SQL Server 2008 database to MySQL database and stored procedures with same functionality.

I am looking forward a very helpful answer from you guys and it will be highly appreciated.

Thanks.

Search for Error Handler. On "MySQL Stored Procedure Programming", written by Guy Harrison and Steven Feuerstein there's also a good example. you can find it searching on Google, bye :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.