drop procedure if exists proc_test;
create procedure proc_test()
  begin
    declare beforeQty int;
    declare enterQty int;
    declare outQty int;
    select sum(aa.`qty_f`) into beforeQty
    from tbl_purinwarehsdetail as aa
    left join tbl_purinwarehshead  as bb on aa.code_f=bb.code_f and bb.status_f<>1
    left join  `tbl_good` as cc on aa.`good_good_f`=cc.`id_f` and cc.status_f<>1
    left join `tbl_unit` as dd on aa.`unit_goodunit_f`=dd.`id_f` and cc.status_f<>1
    left join `tbl_location` ee on aa.`location_location_f`=ee.`id_f` and ee.`status_f`<>1
    group by aa.`code_f`  having bb.`createdate_f`<'2011.4.12';
 
  end;call proc_test();
  select beforeQty;怎么可以循环赋值啊!并打印出来啊