database PLS-00201 在 Oracle 中运行存储过程时出错

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

PLS-00201 Error when running stored procedure in Oracle

databaseoracleoracle11g

提问by

I Recently moved on oracle database for one of my project. I have created a stored procedure for selecting multiple rows from database. Following is my procedure

我最近为我的一个项目移动了 oracle 数据库。我创建了一个用于从数据库中选择多行的存储过程。以下是我的程序

create Or replace
PROCEDURE TEST(p_cursor OUT SYS_REFCURSOR) AS

BEGIN
open p_cursor FOR select * from branch_info;
END TEST;

when I execute this procedure I got following error:

当我执行此过程时,出现以下错误:

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'SAURAV.TEST' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

I have searched for it and found similar question herebut error line and reason are different.

我已经搜索过并在这里找到了类似的问题但错误行和原因不同。

Anyone please help me in solving this.

任何人都请帮我解决这个问题。

EDIT:Misprint TEST with TEXT

编辑:带有文本的错误打印测试

采纳答案by J?cob

The problem is with keyword test

问题在于关键字测试

CREATE OR REPLACE PROCEDURE test (p_cursor OUT sys_refcursor)
AS
BEGIN
    OPEN p_cursor FOR
        SELECT  *
          FROM  branch_info;
END test;

and execute by

并执行

variable rc refcursor;

exec test( :rc );

print rc;

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

Change to some other name

更改为其他名称

CREATE OR REPLACE PROCEDURE test2 (p_cursor OUT sys_refcursor)
AS
BEGIN
    OPEN p_cursor FOR
        SELECT  *
          FROM  branch_info;
END test2 ;

execute as

执行为

variable rc refcursor;

exec test2 ( :rc );

print rc;

PL/SQL procedure successfully completed.

From sql plus

来自 sql plus

SQL> variable usercur refcursor;
SQL> DECLARE
  2  BEGIN
  3  test2(:usercur);
  4  end;
  5  /

PL/SQL procedure successfully completed.

SQL> print usercur;