是否可以在存储过程中打印变量 [英] Is it possible print a variable in stored procedure

查看:77
本文介绍了是否可以在存储过程中打印变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在存储过程中打印变量。我在下面添加我的代码



Is it possible print a variable in stored procedure.I am adding my code below

create procedure dist_profit_pairs1(IN user_id varchar(20),IN plan varchar(20))
begin
DECLARE left_bvs,right_bvs Float DEFAULT 0;
SELECT sum(businessvalues)as left_bvs from bv_history where userid=user_id and type='Distribution Profit' and position='Left';
SELECT sum(businessvalues)as right_bvs from bv_history where userid=user_id and type='Distribution Profit' and position='Right';

IF left_bvs < right_bvs  THEN
    SELECT left_bvs;
ELSE
    SELECT right_bvs;

推荐答案

SELECT left_bvs; 看起来不像是有效的语句。我认为你应该使用 RETURN 来返回必要的结果。
SELECT left_bvs; does not look like a valid statement. I think you should be using RETURN to return the requisite results.


这篇关于是否可以在存储过程中打印变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆