oracle 在 PL/SQL Developer SQL 窗口中执行存储过程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20079228/
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 05:21:58  来源:igfitidea点击:

Executing stored procedure in PL/SQL Developer SQL Window

oracleexecprocedureplsqldeveloperora-00900

提问by user2059532

I've used TOAD for awhile, but my dept has asked me to evaluate PL/SQL Developer as a possible change.

我已经使用 TOAD 一段时间了,但我的部门要求我评估 PL/SQL Developer 作为可能的更改。

I'm trying to run the following in PL/SQL developer. It gives an error saying: ORA-00900: Invalid SQL Statement

我正在尝试在 PL/SQL 开发人员中运行以下内容。它给出了一个错误说:ORA-00900:无效的 SQL 语句

VARIABLE mycur    refcursor;
VARIABLE errorseq NUMBER;
VARIABLE errormsg CHAR;
EXEC rums.rums_sp_tv_project_breakdown2(94090,:mycur);
print mycur;

In TOAD, I can put this in a SQL Editor and hit F5 to "Execute as Script", and the output appears just fine.

在 TOAD 中,我可以将它放在 SQL 编辑器中,然后按 F5 以“作为脚本执行”,输出看起来很好。

Any ideas on how to do this? I see PL/SQL Developer has a command window, but I'm not a SQLPlus guru (perhaps my problem) and can't get it to run in the command window either.

关于如何做到这一点的任何想法?我看到 PL/SQL Developer 有一个命令窗口,但我不是 SQLPlus 专家(也许是我的问题),也无法让它在命令窗口中运行。

回答by Jon Heller

The PL/SQL Developer command window does not support refcursor, it displays the message REFCURSOR not supported.

PL/SQL Developer 命令窗口不支持refcursor,它显示消息REFCURSOR not supported

But the Test Windows does support cursors. First, create a sample procedure in a separate window:

但是测试窗口确实支持游标。首先,在单独的窗口中创建一个示例程序:

create or replace procedure test_procedure(p_cursor in out sys_refcursor) is
begin
    open p_cursor for select 'column 1' col1, 'column 2' col2 from dual;
end;
/

Open a Test Window. Add a variable of type Cursor. Add an anonymous PL/SQL block that uses that variable as a parameter to the sample procedure. Run the PL/SQL block and it will populate the cursor. .PL/SQL Developer Test Window

打开一个测试窗口。添加一个 Cursor 类型的变量。添加一个匿名 PL/SQL 块,该块使用该变量作为示例过程的参数。运行 PL/SQL 块,它将填充游标。.PL/SQL 开发人员测试窗口

Now expand the <Cursor>value and the resutls will appear in a separate window: PL/SQL Developer cursor results

现在展开该<Cursor>值,结果将出现在单独的窗口中:PL/SQL Developer 游标结果