标签:
mysql 自定义raise_application_error 方法:
#自定义rasie error in mysql delimiter // create procedure raise_application_error(In CODE integer ,in message varchar(255)) sql security invoker deterministic begin create temporary table if not exists raise_error(F1 int not null); select CODE , message into @error_code, @error_message; insert into raise_error values(null); end; // create procedure get_last_custom_error() sql security invoker deterministic begin select @error_code ,@error_message; end; // delimiter ; #call raise_application_error(1234, ‘Custom message‘); #call get_last_custom_error();
使用方法:
call raise_application_error(1234, ‘Custom message‘);
生成一个error, Then:
call get_last_custom_error();
Finally , CREATE raise_application_error successfully orz~
MySql Trigger raise_application_error笔记
标签:
原文地址:http://www.cnblogs.com/shootloking/p/4245476.html