create or replace procedure p_XX(tabName in varchar2) is
type t_cursor is ref cursor;
v_cursor t_cursor;
v_SQLStatement varchar2(300);
begin
v_SQLStatement = 'select xx from '||tabName ;
open v_cursor for v_SQLStatement;
loop fetch v_cursor into XXX;
exit when v_cursor%notfound;
--做妳的操作
end loop; close v_cursor;
end;