MYSQL Trigger Raise_application_error Notes

Source: Internet
Author: User

MySQL Custom Raise_application_error method:

#自定义rasie ErrorinchMySQL delimiter//Create procedureRaise_application_error (inchCODEinteger,inchMessagevarchar(255)) SQL Security Invoker deterministicbegin    Create Temporary  Table if  not existsRaise_error (F1int  not NULL); SelectCODE, message into @error_code,@error_message; Insert  intoRaise_errorValues(NULL);End;//Create procedureget_last_custom_error () SQL Security Invoker deterministicbegin    Select @error_code,@error_message; End;//delimiter, #call raise_application_error (1234,'Custom Message'); #call get_last_custom_error ();

How to use:

Call Raise_application_error (1234'Custom message');

Generate an error, then:

Call Get_last_custom_error ();

Finally, CREATE Raise_application_error successfully orz~

MYSQL Trigger Raise_application_error Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.