调用 Oracle PL/SQL PLS-00201:必须声明标识符“001”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6577490/
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
Calling Oracle PL/SQL PLS-00201: identifier '001' must be declared
提问by Oh Chin Boon
I am trying to call a PL/SQL script with the following header:
我正在尝试使用以下标头调用 PL/SQL 脚本:
PL/SQL:
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
回答by WW.
You are using the wrong types of quotes. If you want 001
to be string literal, you need to use single quotes.
您使用了错误的引号类型。如果要001
成为字符串文字,则需要使用单引号。
Try this:
尝试这个:
SELECT '001' FROM dual;
SELECT "001" FROM dual;
回答by Randy
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
检查第一个值是否是过程中的字符串而不是数字。您也可以尝试以 to_number('001') 作为参数
回答by Maxim Shevtsov
Try this :
尝试这个 :
declare c varchar2(100);
begin
hr.getquote('001', c);
end;
/
In pl/sql single quotes must be used for strings.
在 pl/sql 中,字符串必须使用单引号。