oracle EXECUTE 识别存储过程,CALL 不识别

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

EXECUTE recognizes a stored procedure, CALL does not

oraclesqlplus

提问by Stuart Feldt

When I try to run a stored procedure using EXECUTE, the proc runs fine. When I use CALL, I get "ORA-06576: not a valid function or procedure name". I am connecting directly via toad. Why can't I use call?

当我尝试使用 EXECUTE 运行存储过程时,proc 运行良好。当我使用 CALL 时,我得到"ORA-06576: not a valid function or procedure name". 我直接通过蟾蜍连接。为什么我不能使用通话?

I have tried both of these Calls:

我已经尝试了这两个调用:

CALL(BPMS_OWNER.DAILY_PARTITION_NOROTATE('MIP_TEST',5,5,'MIP_TEST_',5,FALSE,TRUE));
CALL BPMS_OWNER.DAILY_PARTITION_NOROTATE('MIP_TEST',5,5,'MIP_TEST_',5,FALSE,TRUE);

The reason I need to use CALL is that our platform parses SQL before we send it to Oracle, which for whatever reason does not support EXECUTE.

我需要使用 CALL 的原因是我们的平台在将 SQL 发送到 Oracle 之前对其进行解析,无论出于何种原因,它都不支持 EXECUTE。

回答by Ben

Simply because callrequiresthat you add parenthesis, for instance, call my_proc()

仅仅因为要求您添加括号,例如,callcall my_proc()

If I set up a little test:

如果我设置一个小测试:

SQL>
SQL> create or replace procedure test is
  2  begin
  3     dbms_output.put_line('hi');
  4  end;
  5  /

Procedure created.

And run this several different ways you'll see

运行这几种不同的方式你会看到

SQL> exec test
hi

PL/SQL procedure successfully completed.

SQL> call test;
call test
     *
ERROR at line 1:
ORA-06576: not a valid function or procedure name


SQL> call test();
hi

Call completed.

Why do you need to use call? Isn't exec, executeand begin ... endenough?

为什么需要使用call?不是execexecute而且begin ... end够了吗?



Based on your update the problem is the booleans, which calldoesn't seem to support. Creating yet another small procedure

根据您的更新,问题是布尔值,它call似乎不支持。创建另一个小程序

SQL> create or replace procedure test (Pbool boolean ) is
  2  begin
  3     if Pbool then
  4        dbms_output.put_line('true');
  5     else
  6        dbms_output.put_line('false');
  7     end if;
  8  end;
  9  /

Procedure created.

SQL> show error
No errors.

and running it proves this

并运行它证明了这一点

SQL> call test(true);
call test(true)
          *
ERROR at line 1:
ORA-06576: not a valid function or procedure name

I don't quite understand your reasoning behind why you can't use execor executebut assuming these are both off limits why not just use a traditional, anonymous PL/SQL block?

我不太明白你为什么不能使用execexecute假设这些都是禁止的为什么不使用传统的匿名 PL/SQL 块?

SQL> begin
  2     test(true);
  3  end;
  4  /
true

PL/SQL procedure successfully completed.