PLS-00103 程序错误
我有 2 台服务器(一台用于测试,一台用于生产),两台服务器都有以下 Oracle 软件包(两台服务器的 SELECT * FROM V$VERSION;
的输出相同:
Oracle9i Enterprise Edition Release 9.2.0.3 .0 - 生产
PL/SQL 版本 9.2.0.3.0 - 生产
CORE 9.2.0.3.0 生产
适用于 Linux 的 TNS:版本 9.2.0.3.0 - 生产
NLSRTL 版本 9.2.0.3.0 - 生产
奇怪的是,它在一台服务器上运行良好,但在另一台服务器上却出现这些错误...我应该在哪里查看?看来是服务器配置问题。
我正在尝试编译此过程:
CREATE OR REPLACE PROCEDURE P_A1 AS
NUMAR INTEGER := 0;
CURSOR A1_C3 IS
SELECT
(SELECT SUM(D1.A_PAY) FROM A1_A D1 WHERE D1.YR_R = D.YR_R AND D1.MON_R = D.MON_R) x_A
FROM APP_COMPANY_ALL CO, A1_A D
WHERE D.YR_R = y.APPL_admin.F$APPL_YEAR
AND D.MON_R = y.APPL_admin.F$APPL_MONTH
AND d.cif=SUBSTR(RTRIM(CO.c_fisc),3);
V_A1 A1_C3%ROWTYPE;
BEGIN
NULL;
END;
我在其中一台服务器上收到以下错误:
PROCEDURE P_A1 的编译错误
Error: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
Text: (SELECT SUM(D1.A_PAY) FROM A1_A D1 WHERE D1.YR_R = D.YR_R AND D1.MON_R = D.MON_R) x_A
Error: PLS-00103: Encountered the symbol ")" when expecting one of the following:
. ( * @ % & - + ; / at for mod rem <an exponent (**)> and or
group having intersect minus order start union where connect
||
Text: (SELECT SUM(D1.A_PAY) FROM A1_A D1 WHERE D1.YR_R = D.YR_R AND D1.MON_R = D.MON_R) x_A
正如我所说,它可以在测试服务器上运行,但不能在生产服务器上运行。 Oracle 版本是相同的。我很确定这是导致此问题的配置选项。但我不知道去哪里寻找解决方案。
如果“Select ( Select ...”不是标量子查询,它就可以正常工作。当它位于游标内时,它会失败。为什么它在生产服务器上不起作用?
I have 2 servers (one for testing, one for production), both have the following Oracle packages (identical output on both of them for SELECT * FROM V$VERSION;
:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
PL/SQL Release 9.2.0.3.0 - Production
CORE 9.2.0.3.0 Production
TNS for Linux: Version 9.2.0.3.0 - Production
NLSRTL Version 9.2.0.3.0 - Production
The strange thing is that it works just fine on one server and it gives these errors on the other one... Where should I look? It seems it's a server configuration problem.
I'm trying to compile this procedure:
CREATE OR REPLACE PROCEDURE P_A1 AS
NUMAR INTEGER := 0;
CURSOR A1_C3 IS
SELECT
(SELECT SUM(D1.A_PAY) FROM A1_A D1 WHERE D1.YR_R = D.YR_R AND D1.MON_R = D.MON_R) x_A
FROM APP_COMPANY_ALL CO, A1_A D
WHERE D.YR_R = y.APPL_admin.F$APPL_YEAR
AND D.MON_R = y.APPL_admin.F$APPL_MONTH
AND d.cif=SUBSTR(RTRIM(CO.c_fisc),3);
V_A1 A1_C3%ROWTYPE;
BEGIN
NULL;
END;
I get the folowing errors on one of the servers:
Compilation errors for PROCEDURE P_A1
Error: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
Text: (SELECT SUM(D1.A_PAY) FROM A1_A D1 WHERE D1.YR_R = D.YR_R AND D1.MON_R = D.MON_R) x_A
Error: PLS-00103: Encountered the symbol ")" when expecting one of the following:
. ( * @ % & - + ; / at for mod rem <an exponent (**)> and or
group having intersect minus order start union where connect
||
Text: (SELECT SUM(D1.A_PAY) FROM A1_A D1 WHERE D1.YR_R = D.YR_R AND D1.MON_R = D.MON_R) x_A
The thing is that, as I said, it works on the test server, but not on the production server. The Oracle versions are identical. I am pretty sure it's a configuration option that's causing this problem. But I don't know where to look for a solution.
The "Select ( Select ..." works just fine if it's not a scalar subquery. It fails when it's inside the cursor. Why doesn't it work on the production server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能只是一个剪切粘贴问题,但在原始帖子中,光标以
我认为不起作用的方式开始。我建议您尝试以下操作:
分享并享受。
This may just have been a cut-n-paste issue, but in the original post the cursor starts with
which I don't think will work. I suggest that you try the following:
Share and enjoy.
在比较两个服务器方面可能值得检查几个初始化参数:
plsql_optimize_level
兼容
这些差异可能会在服务器之间产生不同的行为。您可以通过将其更改为动态 SQL 来验证可能是解析器问题的建议:
Might be worth checking a couple initialization parameters in terms of comparing the two servers:
plsql_optimize_level
compatible
Differences in these could yield different behavior between servers. You can validate the suggestion that it might be the parser issue by changing it to dynamic SQL along the lines of: