近期,某客户遇到12C环境的软件升级时,编译存储过程报错:ORA-00904: "DECL_OBJ#": invalid identifier。经查询MOS文档ORA-00604 Error Occurs at Recursive SQL level While Creating Package/Procedure using SQL Developer on Upgraded 12c Database (Doc ID 2476156.1)与分析实际情况,问题为安装了12C的DBRU后,未应用datapatch -verbose; 

按照文档Doc ID 2476156.1)的说明,重新datapatch -verbose或者修改工具的配置方式解决:Open SQL Developer Set the PLScope identifiers parameter (Tools > Preferences > Database > PL/SQL Compiler > PLScope identifiers) from All to None.。 最终用户反馈是将列数量降低后,解决的。

相关日志如下:

SQL> alter package aa.bb compile;
alter package vamames.entmatpes compile
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00904: "DECL_OBJ#": invalid identifier

ORA-00604 Error Occurs at Recursive SQL level While Creating Package/Procedure using SQL Developer on Upgraded 12c Database (Doc ID 2476156.1)
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@rac02 ~]$
[oracle@rac02 ~]$
[oracle@rac02 ~]$
[oracle@rac02 ~]$ opatch lsinv
Oracle Interim Patch Installer version 12.2.0.1.29
Copyright (c) 2022, Oracle Corporation. All rights reserved.


Oracle Home : /u01/app/oracle/product/12.2.0.1/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/12.2.0.1/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.29
OUI version : 12.2.0.1.4
Log file location : /u01/app/oracle/product/12.2.0.1/dbhome_1/cfgtoollogs/opatch/opatch2022-12-10_14-50-24PM_1.log

Lsinventory Output file location : /u01/app/oracle/product/12.2.0.1/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2022-12-10_14-50-24PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: rac02
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1):

Oracle Database 12c 12.2.0.1.0
There are 1 products installed in this Oracle Home.


Interim patches (2) :

Patch 33261817 : applied on Wed Apr 27 21:54:34 CST 2022
Unique Patch ID: 24444540
Patch description: "Database Oct 2021 Release Update : 12.2.0.1.211019 (33261817)"
Created on 1 Oct 2021, 10:03:49 hrs UTC
Bugs fixed:
32626756, 32755493, 33289442, 7391838, 8480838, 8932139, 8975044
12763598, 13554903, 14221306, 14690846, 15931756, 16002385, 16438495
16727454, 16942578, 17027695, 17533661, 17947871, 17958365, 18308268
18521691, 18594510, 18774543, 18878420, 18986501, 19072655, 19211433
19285025, 19327292, 19526548, 19614243, 19647894, 19649997, 19702201
19721304, 20003668, 20087519, 20118035, 20120236, 20324049, 20436508
20532077, 20549013, 20588486, 20591151, 20617383, 20620169, 20736227
20756305, 20866970, 20917487, 20976443, 21070321, 21089435, 21095391
21143725, 21147908, 21159907, 21178363, 21186167, 21197098, 21216226
21320338, 21355390, 21433452, 21479706, 21517767, 21520266, 21547051
21638600, 21744603, 21788462, 21837606, 21882528, 21935698, 21962287
21981529, 21985256, 22007324, 22070226, 22070473, 22070853, 22072543
22087683, 22104866, 22107360, 22174392, 22179537, 22282748, 22310426
22347493, 22363790, 22364044, 22367053, 22379010, 22446455, 22454940
22468255, 22495673, 22503283, 22503297, 22504793, 22522515, 22530986
22564336, 22568728, 22581771, 22594071, 22599050, 22628825, 22645009
22645496, 22654475, 22700845, 22726044, 22729345, 22820798, 22826067


===