在 TOAD 中执行 Oracle 过程

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

Execute Oracle procedure in TOAD

oracletoad

提问by vps

I am writing an Oracle procedure using TOAD. I executed the procedure using execute statement. But I am not able to get the result. Instead of that am getting error only. Please help how to run the procedure in TOAD. I am new to toad and Oracle.

我正在使用 TOAD 编写 Oracle 过程。我使用execute语句执行了该过程。但我无法得到结果。而不是只有错误。请帮助如何在 TOAD 中运行该程序。我是蟾蜍和 Oracle 的新手。

Procedure in oracle

oracle中的程序

create or replace procedure pro_dndtesting( phone number)is 
begin
select  FLD_PHONENUMBERS from smsdnd_tbl where FLD_PHONENUMBERS=phone;
end ;
/

Executing procedure as follows

执行程序如下

exec procedure pro_dndtesting(9865015695)

error

ORA-06550: line 1, column 7:
PLS-00201: identifier 'PRO_DNDTESTING' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

回答by Frank Schmitt

Just to clarify: there is no such thing as "Oracle Toad". Oracle is a RDBMS, whereas TOAD is a client for Oracle databases.

澄清一下:没有“Oracle Toad”这样的东西。Oracle 是 RDBMS,而 TOAD 是 Oracle 数据库的客户端。

Your procedure won't compile as you have written it because you don't give an INTO clause for the SELECT (since PL/SQL - as opposed to plain SQL - requires a "target" for the result of the SELECT); try this:

您的过程不会像您编写的那样编译,因为您没有为 SELECT 提供 INTO 子句(因为 PL/SQL - 与普通 SQL 相对 - 需要一个“目标”作为 SELECT 的结果);尝试这个:

create or replace procedure pro_dndtesting( phone number)is 
  l_value smsdnd_tbl.fld_phonenumbers%type;
begin
  select  FLD_PHONENUMBERS 
    into l_value 
    from smsdnd_tbl 
   where FLD_PHONENUMBERS=phone;
end ;

As for the error you're getting:

至于你得到的错误:

Did you use the same schema (=user) for defining the procedure and calling it?

您是否使用相同的架构(=用户)来定义过程并调用它?

Did you try it from an anonymous PL/SQL block like

您是否从匿名 PL/SQL 块中尝试过,例如

begin
  pro_dndtesting(9865015695);
end;