null - no return value of call procedure mysql -


i have procedure in mysql , has 4 parameters input , 3 parameters of output , 1 param of output doesn't return nothing (null).

delimiter $$ drop procedure if exists `cierremes`$$ create procedure cierremes (in tarjeta varchar(100),in bancobus varchar(100),in mes int,in anyo int, out total int, out nulas int, out erroneas int) begin     declare stockactual int default 0;     declare cantidad int;     /*declare xcantidad,xnulas,xerroneas int;*/     declare entrada, salida int default 0;     declare total int default 0;       select stock         stockactual     almacen     idproducto =          (select idproducto productos productos.banco = bancobus , productos.plastico = tarjeta);      call entradassalidas(tarjeta,bancobus,mes,anyo,@ent,@sal);     set entrada = @ent;     set salida = @sal;      call obtenermovimientosmes(tarjeta,bancobus,mes,anyo,@cant,@nul,@err);     set cantidad = @cant;     set nulas = @nul;     set erroneas = @err;          set total =(stockactual + entrada) - (salida + cantidad);      select total;   end$$ delimiter ;  call cierremes('4b mc','santander',3,2013, @total, @nulas, @erroneas);  select @total, @nulas, @erroneas; 

when "call" @nulas , @erroneas return value, @total nothing.

with select total, works fine. no returns value, in select : select @total, @nulas, @erroneas; @total null.

you calculate total formula:

set total =(stockactual + entrada) - (salida + cantidad); 

if 1 of values used in calculation null, total null.

i can see set statements entrada, salida, , cantidad. value of stockactual?

it seems missing statement set value of stockactual.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -