日期:2014-05-17  浏览次数:21152 次

oracle如何执行包的存储过程
现有包
CREATE OR REPLACE PACKAGE PKG_AllConsumeBlock is
  TYPE myrctype IS REF CURSOR; 
  PROCEDURE usp_AllConsumeBlock(cur_out OUT myrctype,StartMth char,FinishiMth char);
end PKG_AllConsumeBlock;

包体
CREATE OR REPLACE PACKAGE BODY PKG_AllConsumeBlock AS  
  PROCEDURE usp_AllConsumeBlock
  (
  cur_out OUT myrctype,StartMth char,FinishiMth char
  )
  IS
  BEGIN
OPEN cur_out FOR
  SELECT * from 表名 where 条件 ;
  END usp_AllConsumeBlock;  
END PKG_AllConsumeBlock;

请问该如何调用来进行查询?谢谢各位了


------解决方案--------------------
探讨
引用:

SQL> var c refcursor
SQL> begin
2    PKG_AllConsumeBlock.PROCEDURE usp_AllConsumeBlock(:c, para1, para2);
3  end;
4  /

PL/SQL procedure successfully completed.

SQL> print :c


还是没看懂,能解释一下上面的代码吗?

我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html