Ao atualizar nossas instâncias de 11g para 12c começamos a receber o erro abaixo ao criar packages, triggers e procedures no SQL Developer:
Error report –
ORA-00604: error occurred at recursive SQL level 1
ORA-00904: “DECL_OBJ#”: invalid identifier
00604. 00000 – “error occurred at recursive SQL level %s”
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
O código que eu tava tentando executar era de uma trigger de DDL, que por ventura, rodava com sucesso no SQLPlus. Levando a crer que fosse um problema exclusivo do SQL Developer:
create or replace TRIGGER ADMIN.TG_AUDIT_DDL after ddl on DATABASE begin if (ora_dict_obj_name like 'ORA_TEMP%') then null; else insert into AUDITORIA.TB_ALTERACOES values( sysdate, sys_context('USERENV','OS_USER'), sys_context('USERENV','CURRENT_USER'), sys_context('USERENV','HOST'), sys_context('USERENV','TERMINAL'), ora_dict_obj_owner, ora_dict_obj_type, ora_dict_obj_name, ora_sysevent ); end if; end;
Para solucionar o problema, precisamos fazer o seguinte ajuste no SQL Developer:
Clique em Tools > Preferences > Database > PL/SQL Compiler > PLScope identifiers e troque de All para None conforme imagens abaixo.
Após alterar o campo PLScope Identifiers para NONE seu SQL Developer voltará a funcionar normalmente.