Oracle Ref Cursor的使用,以及返回记录数

来源:互联网 发布:张家口军事 知乎 编辑:程序博客网 时间:2024/06/14 01:51

可以通过下列代码了解Ref Cursor的使用,但是能得到返回的记录数吗?我现在以我这几天的研究的水平告诉大家,不行, 只有两个方法可以实现,1.循环两次游标,2.或者通过count(1) over ()添加一列,来得到返回的数据记录数。我觉得可能后者会更好,前者太笨了。 希望后续版本能改善这个问题。 declare type refcursor is ref cursor; --ref游标类型 infolist refcursor; --集合 customer bi_customer%rowtype; --行 customercode bi_customer.customercode%type;--字段 customername bi_customer.corporation%type; begin open infolist for select bi.* from bi_customer cf; --全部 loop fetch infolist into customer; exit when infolist%notfound; dbms_output.put_line('客户编号为;:'||''||customer.customercode||', 地址为:'||customer.address ); end loop; close infolist; end;

原创粉丝点击