I need to conditionally raise an error, but I can only use a simple statement and no stored procedure.
I'd like to do something like this:
select case when foo = "bar" then 1 else SIGNAL SQLSTATE 'ERROR' end;
Unfortunately SIGNAL is only usable in triggers and procedures and I have to use this within an existing application that only allows me to enter statements, but not procedures. (I only have one long line and no way to set a DELIMITER etc.)
Is there any other way to conditionally cause a runtime error ?