您的位置:首页 > 数据库 > Oracle

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

2010-08-11 14:18 387 查看
可以通过下列代码了解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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: