Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Do
-
None
Description
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');
|
https://github.com/alibaba/AliSQL/commit/66c68db51483d6c719e13ab6a5dfdcb04ae22333
Attachments
Activity
Transition | Time In Source Status | Execution Times |
---|
|
1d 2h 12m | 1 |