....
declare
CURSOR c is
select 'select' || xxx || ' from yyy;' into value
from zzz
where ...;
c1 is c%ROWTYPE;
begin
...
for loop
??? how to execute the c's result here???
end;
...全文
743打赏收藏
一个简单的CURCOR问题,解决给50分
.... declare CURSOR c is select 'select' || xxx || ' from yyy;' into value from zzz where ...; c1 is c%ROWTYPE; begin ... for loop ??? how to execute the c's result here??? end;
declare
type t_sor is ref cursor;
v_sor t_sor;
str varchar2(50);
begin
str:='select '||xxx||' from yyy';
open v_sor for str;
loop
fetch v_sor into value;
when v_sor%notfound then exit;
dbms_output.put_line(value);
end loop;
end;
/