【问题标题】:mysql out parameter for procedure not showing未显示过程的mysql out参数
【发布时间】:2012-09-27 02:57:33
【问题描述】:

我创建了一个过程,其中有 2 个输入参数和 1 个输出参数。但是,我不知道为什么我的输出不想出来。我不想使用 select 语句。我想使用 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 !为什么?

【问题讨论】:

    标签: mysql parameters out


    【解决方案1】:

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

    SELECT @total;
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-08
      • 1970-01-01
      • 1970-01-01
      • 2021-06-08
      • 2020-01-09
      • 2023-02-08
      • 2015-11-20
      相关资源
      最近更新 更多