我有 2 台服务器(一台用于测试,一台用于生产),都有以下 Oracle 包(它们的输出相同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:版本 9.2.0.3.0 - Production
NLSRTL 版本 9.2.0.3.0 - Production
奇怪的是,它在一台服务器上运行良好,而在另一台服务器上却出现了这些错误……我应该去哪里看?看来是服务器配置问题。
我正在尝试编译此过程:
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 ...”工作得很好。当它在游标内时它会失败。为什么它不能在生产服务器上工作?