返回结果集的储存过程

 sys_refcursor是oracle9i以后系统定义的一个refcursor,主要用在过程中返回结果集。 如果仅仅为了返回值,无需自己在包头中定义游标类型,只需直接使用sys_refcursor即可轻松返回结果。

       但如果返回结果需要中间计算,就需要临时表进行存储,最后返回。

 

例如 

create or replace procedure cur_test( param varchar2,
mycur OUT sys_refcursor) is
begin
open mycur for select u.* from sc_user u where u.id=param ;
end cur_test;

posted @ 2018-05-24 16:18  _debug—  阅读(134)  评论(0编辑  收藏  举报