gpt4 book ai didi

过程不显示的 mysql out 参数

转载 作者:行者123 更新时间:2023-11-29 05:33:28 25 4
gpt4 key购买 nike

我创建了一个过程,其中有 2 个输入参数和 1 个输出参数。但是,我不知道为什么我的输出不想出来。我不想使用选择语句。我想使用 out 参数。谢谢。

create procedure quiz_totals(in q1 double unsigned, in q2 double unsigned, out p_total int)
begin
declare v_ceil_q1 int;
declare v_ceil_q2 int;
declare v_max int;
declare v_min int;

set v_ceil_q1 := ceiling(q1);
set v_ceil_q2 := ceiling(q2);

create table temp_tbl(t_scores int);
insert into temp_tbl(t_scores) values(v_ceil_q1), (v_ceil_q2));

select max(t_scores) into v_max from temp_tbl;
select min(t_scores) into v_min from temp_tbl;

set p_total := (v_ceil_q1) + (v_ceil_q2) + v_max - 2*v_min;

drop table temp_tbl;
end;
#
delimiter ;
call quiz_totals(23, 32.4, @total);

这是我的输出:

Query OK, 0 rows affected (0.02 sec)

没有 p_total !为什么?

最佳答案

你需要一个选择,即使你不想...

SELECT @total;

如果你想看看里面有什么!

关于过程不显示的 mysql out 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12754950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com