oracle 如何运行程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/839154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:50:26  来源:igfitidea点击:

How to Run the Procedure?

oracleplsql

提问by Tony Andrews

Here the Package..

这里的包..

CREATE OR REPLACE PACKAGE G_PKG_REFCUR AS
    TYPE rcDataCursor IS REF CURSOR;
END;

Let's consider the PROC..

让我们考虑 PROC..

Create procedure gokul_proc(
    pId in number,
    pName in varchar2,
    OutCur OUT G_PKG_REFCUR.rcDataCursor ) is
BEGIN
    Open OutCur For
        select * from gokul_table ob 
        where ob.active_staus-'Y' AND ob.id=pId AND ob.name=pNname;
END;

Here is my question: How can I execute this procedure?

这是我的问题:我如何执行此程序?

If there isn't an OutCur parameter, then I can execute like this..

如果没有 OutCur 参数,那么我可以像这样执行..

EXEC gokul_proc(1,'GOKUL');

but, the problem is OutCur. I don't know which value to pass here.

但是,问题是 OutCur。我不知道在这里传递哪个值。

For example

例如

EXEC gokul_proc(1,'GOKUL', ??????);

I just need to know what value to pass as a argument for the procedure.

我只需要知道要作为过程参数传递的值。

回答by Tony Andrews

In SQL Plus:

在 SQL Plus 中:

VAR rc REFCURSOR
EXEC gokul_proc(1,'GOKUL', :rc);
print rc