Is it possible to 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; -
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;Hi I assume you want to print the variable value when executing in sqlserver studio management. If so, you can print the variable value by
print variablename
regards Naina
Naina
-
Hi I assume you want to print the variable value when executing in sqlserver studio management. If so, you can print the variable value by
print variablename
regards Naina
Naina