gpt4 book ai didi

mysql - INOUT Parameter Mysql Procedure(不是IN OUT)

转载 作者:行者123 更新时间:2023-11-30 22:18:04 24 4
gpt4 key购买 nike

我有一个被设计为

OUT       id
INOUT name
IN password
OUT activate

我想检索值 id、name、active。

当我这样做

CALL login(@id,'abc','abc',@activate);
select @id as rm_out_param, @activate as active_out_param,@name as uname;

它告诉我一个错误

OUT or INOUT argument 2 is not a variable

当我尝试使用

CALL login(@id,@name,'abc','abc',@activate);
select @id as rm_out_param, @activate as active_out_param,@name as uname;

它告诉我错误

Invalid arguments supplied expected 4,5 given

如何克服这个问题以获得结果输出如 id、name、active

非常感谢

最佳答案

I have a stored proc which has been designed as

OUT       id
INOUT name
IN password
OUT activate

因为上面的三个参数都是OUT类型。因此,您必须传递变量而不是任何值或字符串文字。

那么,这里你应该如何调用这个过程:

SET @name := 'abc';

CALL login(@id,@name,'abc',@activate);

select @id as rm_out_param, @activate as active_out_param,@name as uname;

关于mysql - INOUT Parameter Mysql Procedure(不是IN OUT),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37541549/

24 4 0