Bug #16999 RAISEERROR or similar
Submitted: 1 Feb 2006 10:49 Modified: 4 Mar 2009 20:30
Reporter: Nuno Soares Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S4 (Feature request)
Version:5.0.18 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[1 Feb 2006 10:49] Nuno Soares
Description:
How can I raise a custom error to be treated in the client side ?
In SQL Server, we can invoke RAISEERROR to pass custom errors to the client application. Is there any way of doing it in MySQL ?

SQL Server example: RAISEERROR('MYCUSTOMDBERROR', 16, 1)

How to repeat:
RAISEERROR('MYCUSTOMDBERROR', 16, 1)
[1 Feb 2006 11:24] Valeriy Kravchuk
Thank you for a useful feature request.

In current 5.0.x versions you have to "provoke" errors to raise them. Insert a duplicate value into unique key column or something similar.
[13 Sep 2006 21:02] Peter Gulutzan
WL#2110
[6 Feb 2007 19:41] Jorge Bernal
Any estimated time or plans on this? Is this the bug I should subscribe to get notified of updates?

Thanks,
  Koke
[7 Feb 2007 9:48] Valeriy Kravchuk
Standard SQL way to do this (with SIGNAL statement) will be implemented eventually. Do not expect this feature to be implemented in 5.0.x or 5.1.x, though.
[15 Apr 2008 1:34] Ondra Zizka
And some non-standard way? Eg.:

http://rpbouman.blogspot.com/2005/11/using-udf-to-raise-errors-from-inside.html
[15 Apr 2008 2:52] Ondra Zizka
Actually, what is the problem in introducing a function that would work exactly like the UDF mentioned here?

http://rpbouman.blogspot.com/2005/11/using-udf-to-raise-errors-from-inside.html

Or creating any (even non-standard) way to raise an error? Using work-arounds is much worse solution than having something non-standard in one major version.
[28 Apr 2008 13:52] Sergei Golubchik
see bug#11661
[4 Mar 2009 20:30] Paul DuBois
SIGNAL and RESIGNAL are implemented as of MySQL 6.0.11:

http://dev.mysql.com/doc/refman/6.0/en/signal-resignal.html