... cursor c is select ....; ... begin open c; fetch c into ...; while c%found loop ... fetch c into ...; end loop; ...
可能要使用到游标变量,静态游标不能实现。create procedure name_pro(p_table in varchar2) as type t_sor is ref cursor; v_sor t_sor; str varchar2(50); begin str:='select * from cat where table_name='||upper(p_table); open v_sor for str; end; /
cursor c is select ....;
...
begin
open c;
fetch c into ...;
while c%found loop
...
fetch c into ...;
end loop;
...
as
type t_sor is ref cursor;
v_sor t_sor;
str varchar2(50);
begin
str:='select * from cat where table_name='||upper(p_table);
open v_sor for str;
end;
/