Skip to main content

Do not declare cursor bodies in a package specification

Cursor declarations can be splitted in two parts: specification and body. When declaring a cursor in a package specification, the package specification should contains only the cursor specification and the cursor body should be added to the package body.

In newer versions of Oracle Forms, the usage of cursors declared with body in a package specification also causes the compilation error "internal error [Unexpected fragile external reference.]".

Noncompliant Code Example

create or replace package pkg is
cursor cur is
select dummy from dual;
end;

Compliant Solution

create or replace package pkg is
type cur_type is record(dummy varchar2(1));
cursor cur return cur_type;
end;
/
create or replace package body pkg is
cursor cur return cur_type is
select dummy from dual;
end;
/