Calling Oracle PL/SQL PLS-00201: identifier '001' must be declared

风流意气都作罢 提交于 2019-12-12 17:08:09

问题


I am trying to call a PL/SQL script with the following header:

PL/SQL:

CREATE OR REPLACE PROCEDURE GETQUOTE(i_QUOTEID IN HR.QUOTEID,
                                     o_QUOTE OUT HR.QUOTE)

Execute command:

DECLARE c VARCHAR2(100);

BEGIN

  HR.GETQUOTE("001", c);

END;
/

Error:

declare
c varchar2(100);
begin
HR.GETQUOTE("001", c);
end;

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

回答1:


You are using the wrong types of quotes. If you want 001 to be string literal, you need to use single quotes.

Try this:

SELECT '001' FROM dual;

SELECT "001" FROM dual;



回答2:


use the single quotes:

then

check that the first value is a string not a number inside the procedure. you may also try to_number('001') as the argument




回答3:


Try this :

declare c varchar2(100);

begin    
  hr.getquote('001', c);    
end;    
/

In pl/sql single quotes must be used for strings.



来源:https://stackoverflow.com/questions/6577490/calling-oracle-pl-sql-pls-00201-identifier-001-must-be-declared

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!