You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Feature] Issue#61 new built-in function to let customer manually issue an error
A new built-in function RAISE_ERROR('diagnostic-string') is needed to
let mysql users fail current statement with the desired
diagnostic-string error message and reserved sql error code.
DB2 does in its' RAISE_ERROR() function, where the function accepts
parameters of sql state and msg, and Oracle's RAISE_APPLICATION_ERROR
has similar function.
In our implementation, raise_error() accepts parameter of msg and
optional sql state, both are strings. NULL value input is not allowed
for either one, and only validate sql state is allowed.
Here are samples:
--error ER_SP_BAD_SQLSTATE
select raise_error(NULL, 'null sql state not allowed');
--error ER_MALFORMED_MESSAGE select raise_error('70001', NULL);
--error ER_SP_BAD_SQLSTATE
select raise_error('00001', 'invalid sql state');
--error ER_SP_BAD_SQLSTATE
select raise_error('666666', 'length of sql state exceeds 5');
--error ER_INTENTIONAL_ERROR
select raise_error('70001', 'this is a sample error msg');
--error ER_INTENTIONAL_ERROR
select raise_error('this is a sample error msg');
--error ER_INTENTIONAL_ERROR
select raise_error('only error message applied');
0 commit comments