oracle PLS-00103:遇到符号“;” 当期待以下之一时:
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16308701/
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
PLS-00103: Encountered the symbol ";" when expecting one of the following:
提问by Brad
I am trying to insert the answer to a user's security question, for use in the pin reset feature.
我正在尝试插入用户安全问题的答案,以用于 pin 重置功能。
Ellucian banner v8+ provides an API for running this and I very new to their API and from the looks of the error message below, I am far from running this correctly. Any help is appreciated.
Ellucian banner v8+ 提供了一个用于运行它的 API,我对他们的 API 非常陌生,从下面的错误消息的外观来看,我远未正确运行它。任何帮助表示赞赏。
I tried running this in Oracle SQL Developer:
我尝试在 Oracle SQL Developer 中运行它:
execute gb_pin_answer.p_create(
P_PIDM => 12345,
P_NUM => 1,
p_gobqstn_id => 1,
p_qstn_desc => '',
p_ansr_desc => 'David',
p_ansr_salt => 'A123B456',
p_user_id => 'W:H12345678',
p_data_origin => 'WWW_USER',
p_rowid_out OUT gb_common.internal_record_id_type
);
This is a shot in the dark, but I thought I'd give it a shot, error message that displays when trying to execute that package's p_create function:
这是黑暗中的一个镜头,但我想我会试一试,尝试执行该包的 p_create 函数时会显示错误消息:
Error starting at line 15 in command: execute gb_pin_answer.p_create( Error report: ORA-06550: line 1, column 30: PLS-00103: Encountered the symbol ";" when expecting one of the following:
( ) - + case mod new not null table continue avg count current exists max min prior sql stddev sum variance execute multiset the both leading trailing forall merge year month day hour minute second timezone_hour timezone_minute timezone_region timezone_abbr time timestamp interval date 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
Error starting at line 16 in command: P_PIDM => 12345, Error report: Unknown Command
Error starting at line 17 in command: P_NUM => 1, Error report: Unknown Command
Error starting at line 18 in command: p_gobqstn_id => 1, Error report: Unknown Command
Error starting at line 19 in command: p_qstn_desc => '', Error report: Unknown Command
Error starting at line 20 in command: p_ansr_desc => 'David', Error report: Unknown Command
Error starting at line 21 in command: p_ansr_salt => 'A123B456', Error report: Unknown Command
Error starting at line 22 in command: p_user_id => 'W:H12345678', Error report: Unknown Command
Error starting at line 23 in command: p_data_origin => 'WWW_USER', Error report: Unknown Command
Error starting at line 24 in command: p_rowid_out OUT gb_common.internal_record_id_type Error report: Unknown Command
Error starting at line 25 in command: ) Error report: Unknown Command
在命令中从第 15 行开始出错:执行 gb_pin_answer.p_create( 错误报告:ORA-06550:第 1 行,第 30 列:PLS-00103:遇到符号“;”,期望出现以下情况之一:
( ) - + case mod new not null table continue avg count current exists max min prior sql stddev sumvariance execute multiset the both leading trailing forall merge year month day hour minute second timezone_hour timezone_minute timezone_region timezone_abbr 时间时间戳间隔日期 06550. 00000 - "line %s,列 %s:\n%s" *原因:通常是 PL/SQL 编译错误。*行动:
从命令第 16 行开始出错:P_PIDM => 12345,错误报告:未知命令
从命令第 17 行开始出错:P_NUM => 1,错误报告:未知命令
从第 18 行开始的错误命令:p_gobqstn_id => 1,错误报告:未知命令
从命令第 19 行开始出错:p_qstn_desc => '',错误报告:未知命令
从命令第 20 行开始出错:p_ansr_desc => 'David',错误报告:未知命令
从命令第 21 行开始出错:p_ansr_salt => 'A123B456',错误报告:未知命令
从命令第 22 行开始出错:p_user_id => 'W:H12345678',错误报告:未知命令
从命令第 23 行开始出错:p_data_origin => 'WWW_USER',错误报告:未知命令
从命令第 24 行开始出错:p_rowid_out OUT gb_common.internal_record_id_type 错误报告:未知命令
从命令中的第 25 行开始出错:) 错误报告:未知命令
This is where I read up on using this function, p_create: http://inb1.banner.ecu.edu:9090/api_erd_index_guide/api/general/gb_pin_answer.html#p_create
这是我阅读使用此函数 p_create 的地方:http://inb1.banner.ecu.edu:9090/api_erd_index_guide/api/general/gb_pin_answer.html#p_create
UPDATE: code that is erroring out:
更新:出错的代码:
SET SERVEROUTPUT ON
declare
l_rowid_out gb_common.internal_record_id_type;
BEGIN
gb_pin_answer.p_create(P_PIDM => 36706, P_NUM => 1, P_GOBQSTN_ID => 1, P_QSTN_DESC => '', P_ANSR_DESC => 'David', P_ANSR_SALT => 'HB123456', P_USER_ID => 'H00036657', P_DATA_ORIGIN => 'WWW_USER', P_ROWID_OUT => 1_rowid_out);
dbms_output.put_line('rowid: ' || l_rowid_out);
END;
Error msg:
错误消息:
Error report: ORA-06550: line 4, column 199: PLS-00363: expression '1' cannot be used as an assignment target ORA-06550: line 4, column 3: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
错误报告:ORA-06550:第 4 行,第 199 列:PLS-00363:表达式“1”不能用作赋值目标 ORA-06550:第 4 行,第 3 列:PL/SQL:语句被忽略 06550.00000 -》行%s,列 %s:\n%s" *原因:通常是 PL/SQL 编译错误。*行动:
回答by Alex Poole
The problem is the execute
. That's actually shorthand for a short anonymous PL/SQL block, and cannot be split across lines. (Except maybe with a continuation character, but I can't remember off-hand if I've ever got that to work). Only the first line is translated, so it's effectively trying to run:
问题是execute
. 这实际上是简短的匿名 PL/SQL 块的简写,并且不能跨行拆分。(除了可能有一个延续字符,但我不记得我是否曾经让它工作过)。只有第一行被翻译,所以它有效地尝试运行:
begin execute gb_pin_answer.p_create(; end;
/
... and it quite reasonably then doesn't like the command ending as p_create(;
. The rest of the procedure call is then treated as 10 separate commands, which generate the other errors you get, and they are also reasonable in that context.
......而且它很合理地不喜欢以p_create(;
.结尾的命令。然后将过程调用的其余部分视为 10 个单独的命令,这些命令会生成您遇到的其他错误,并且它们在该上下文中也是合理的。
The solution is to either put the entire procedure call on one line, which will make it harder to read; or simply to use your own block, rather than relying on execute
:
解决方案是要么将整个过程调用放在一行,这会使其更难阅读;或者只是使用您自己的块,而不是依赖execute
:
begin
gb_pin_answer.p_create(
...
);
end;
/
The last parameter isn't right though; the bit from OUT ...
needs to be replaced with => some_value
, like you've done with the others. But it is an out parameter, so you need something to put the value in. Without seeing what else is in the script you're running I can't tell if you've already taken care of it, but with this pattern you can probably just add a variable to the anonymous block:
不过最后一个参数不对;位 fromOUT ...
需要替换为=> some_value
,就像您对其他人所做的那样。但它是一个 out 参数,所以你需要一些东西来把值放进去。 没有看到你正在运行的脚本中还有什么我不知道你是否已经处理过它,但是使用这种模式你可以可能只是向匿名块添加一个变量:
set serveroutput on
declare
l_rowid_out gb_common.internal_record_id_type;
begin
gb_pin_answer.p_create(
...
p_rowid_out => l_rowid_out
);
-- optional
dbms_output.put_line('rowid: ' || l_rowid_out);
end;
/
回答by J. Chomel
From the last edit, I see that you misstaken 1
for l
...
1_rowid_out
instead of l_rowid_out
.
从最后的编辑,我看到你misstaken1
为l
......
1_rowid_out
而不是l_rowid_out
。
You cannot start a variable with a number like you tried to.
你不能像你尝试的那样用数字开始一个变量。