存储过程中输入表名还有输出游标以及其测试块

--游标作为一个类型共用

create package pack1 is
type my_cursor is ref cursor;
end;

--输出游标为了程序后续使用,此游标打印所有输入表名的所有内容

create or replace procedure showall(v_table varchar2,v_out_result out pack1.my_cursor) is

begin
 open v_out_result for ' select * from '||v_table;

end showall;


--测试过程:


declare
v_table varchar2(20):='userTable';
v_out pack1.my_cursor;
tt usertable%rowtype;
begin
  showall(v_table,v_out_result =>v_out );
  loop
  fetch v_out into tt;
  dbms_output.put_line(tt.userid||tt.username);
  exit when v_out %notfound;
  end loop;
  close v_out;
  end;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值