转自 http://bbs.csdn.net/topics/100131375
原文标题:如何在游标for循环中使用动态SQL语句?
定义一个ref cursor,然后open refcur for sqlstr,例如
-- Created on 2006-8-22 by ADMINISTRATORdeclare
-- Local variables here
i integer;
type myref is ref cursor;
my myref;
s varchar2(40);
begin
-- Test statements here
s := 'select stkcode from tr_gfk';
open my for s;
close my;
end;