oracle建游标变量包,且在存储过程中使用

--建包
createorreplacepackage PA_BGYZB as
type sp_cursor is ref cursor;
end PA_BGYZB;



--存储过程调用包
create or replace procedure PRO_GETYFBGYZB(jgidInput  in varchar2, yfsbInput  in varchar2 ,--输入变量
                                           bgyzb_cursor out PA_BGYZB.sp_cursor
                                    ) as
  ypxh1 NUMBER( 18);
  ypcd1 NUMBER( 18);
  ypsl1 NUMBER( 10,4 );
  ypgg1 VARCHAR2( 200);
  lsje1 NUMBER( 12,4 );
begin
     open bgyzb_cursor for select a.ypxh as YPXH,a.YPCD,a.ypsl,b.yfgg ,a.lsje 
  into ypxh1,ypcd1,ypsl1,ypgg1,lsje1
    from yf_kcmx a, yf_ypxx b
   where a.jgid = b.jgid
     and a.yfsb = b.yfsb
     and a.ypxh = b.ypxh
     and a.jgid = jgidInput
     and a.yfsb = yfsbInput;
end PRO_GETYFBGYZB;

猜你喜欢

转载自wjch-111.iteye.com/blog/2332044