ALTER PROCEDURE "DBA"."pro_tools_HandlePercent2"(@monthCount int,@targeBiz varchar(9999),@mySql varchar(9999),@pzTableName varchar(500))
begin
declare eof exception for sqlstate value '02000';
declare cur_Aname cursor for select distinct colName from #tmpTB;
execute immediate 'select colName into #tmpTB from #rsColumns';
--迭代游标
open cur_Aname with hold;
_Atype: loop
fetch cur_Aname into @colName;
if sqlstate = eof then leave _Atype
end if;
set @sql = 'select * into #temp from (select ' + @colName + ' ' + @tt + ') pp order by ' + @colName + ' asc;';
execute(@sql);
end loop _Atype;
close cur_Aname;
commit;
end
SybaceIQ游标的使用
最新推荐文章于 2020-11-24 22:13:15 发布