[英]MySQL: how to call a stored procedure with only an output parameter?
From my instruction book, I created the following procedure in which the INSERT statement will yield an error:在我的说明书中,我创建了以下过程,其中 INSERT 语句将产生错误:
create procedure f1
(out error char(5))
begin
declare continue handler for SQLSTATE '23000'
set error='23000';
set error ='00000';
insert into teams values(2,27,'derde');
end;
However, it doesn't say how to call this procedure.但是,它没有说明如何调用此过程。 I tried我试过
call f1;
call f1();
call f1(error);
but none of these works.但这些都不起作用。
Thanks!谢谢!
You must change your stored procedure if you want to view the error values as a result.如果您想查看错误值作为结果,您必须更改您的存储过程。 The SP like SP喜欢
**SELECT error**
and Please try to call procedure like并请尝试调用程序
**CALL f1(@error)
SELECT @error**
some_variable = call f1(); some_variable = 调用 f1(); It will work它会工作
Try the following: CALL f1();
尝试以下操作: CALL f1();
. .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.