Hi!
> Has anyone ever thought of making a UDF that would emulate an Oracle-style
> RAISE EXCEPTION command? MySQL is getting very nice with stored procedures
yes, see:
http://rpbouman.blogspot.com/2005/11/using-udf-to-raise-errors-from-inside.html
You can find a UDF that raises an exception in lib_mysqludf_udf, see:
http://www.mysqludf.org/lib_mysqludf_udf/index.php#udf_init_error
(this uses a combination of a UDF and a stored procedure to set
@SQLERRM and @SQLCODE)
> and triggers, but on implementing business rules with such toills you are
> always confronted with the need of passing meaningful error messager to
> people who interface to the DB. So there is a real need for user-defined
> exceptions.
The real problem is though that you cannot distinguish between 'the
UDF crapped out on us' vs 'An exception was raised'
In the application code you can kind of work around that by looking
for the name of the particular udf though.
I hope this helps.
kind regards
Roland Bouman