| 发表于:2007-10-19 17:37:42 楼主 |
第一次使用临时表,遇到点问题,望达人予以解决下,先谢啦 drop procedure im_proc_querycorppaytran ; create procedure im_proc_querycorppaytran( in ..... out out_proc_code varchar(5) --存储过程返回码 ) dynamic result sets 1 begin --声明变量 declare v_flowno int default 0; declare at_end int default 0; . . . declare....; declare global temporary table session.temp( flowno varchar(15), --流水号 . . ) with replace not logged; --****************************************** --游标里面的记录 end declare cur_list cursor with hold with return for select * from table_a; declare continue handler for not found begin set sqlcode=100; set at_end=1; end; declare cur_list_temp cursor with hold with return for select * from session.temp for read only; open cur_list; fetch cur_list into v_flowno,...........; while (at_end=0) do insert into session.temp values(v_flowno.......); end if; fetch cur_list into v_flowno,..............; end while; close cur_list; commit; open cur_list_temp; set out_proc_code='00000'; end; 但是系统提示在****线这里提示出错,即声明临时表和声明游标之间.提示不能在这里声明游标 不知道是为什么,请高手解释下,谢谢 |
|
|
|
|