这个存储过程怎样调用?

刘大黑 2003-08-04 06:13:02
CREATE OR REPLACE PACKAGE pkg_test
AS
TYPE myrctype IS REF CURSOR;

PROCEDURE get (p_id NUMBER, p_rc OUT myrctype);
END pkg_test;
/

CREATE OR REPLACE PACKAGE BODY "PKG_TEST"
AS
PROCEDURE get (p_id NUMBER, p_rc OUT myrctype)
IS
sqlstr VARCHAR2 (500);
BEGIN
IF p_id = 0
THEN
sqlstr := 'SELECT * FROM CBS_SALE_PROD ';
OPEN p_rc FOR sqlstr;

ELSE
sqlstr := 'select * FROM CBS_SALE_PROD WHERE CBS_prod_id=:wid ';
OPEN p_rc FOR sqlstr USING p_id;
END IF;
END get;
END pkg_test;
/


我的调用过程如下
declare myrctype IS REF CURSOR;
begin
pkg_test.get(1,myrctype output);
end;

不知道在其他过程或者前台程序如何调用,请高手指点

...全文
18 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2003-08-04
  • 打赏
  • 举报
回复
declare
v_rc pkg_test.myrctype;
v1 CBS_SALE_PROD.col1%type;
v2 CBS_SALE_PROD.col2%type;
....
begin
pkg_test.get(1,v_rc);
loop
fetch v_rc into v1,v2,...;
exit when v_rc%notfound;
dbms_output.put_line(v1||v2||....);
end loop;
end;
/
jiezhi 2003-08-04
  • 打赏
  • 举报
回复
in sqlplus:
exec pkg_test.get(1,myrctype output);
前端調用就看你是什么語言了。

17,089

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧