今天遇到一个奇怪的问题,存储过程的调用序列编译是报错 Error: PLS-00302: component 'SEQUENCE_NAME' must be declared
序列是存在,拿出来可以执行成功,序列加前缀了,最后找到原因了是因为用户下有一个表和用户名同名导致的,这是oracle一个bug 已经修复了影响的版本为PL/SQL - Version: 10.2.0.4 to 11.2.0.3 - Release: 10.2 to 11.2
如下图报错:
解决方法:
Rename/ drop any conflicting object with the same name as the schema name
SELECT OBJECT_NAME, OBJECT_TYPE
FROM ALL_OBJECTS
WHERE OBJECT_NAME='USERNMAME'
原因:
An object exists with the same name as the schema owner causing a pl/sql compilation error. Bug:1218383PLS-327 WHEN COMPILE SCHEMA.SEQUENCE WITH EXISTING TABLE WITH SCHEMA NAME
以下在 11.2.0.1.0 的环境重现这个问题
C:\Users\Administrator>sqlplus u