I have an anonymous pl / sql block with a procedure declared inside it, as well as a cursor. If I declare a procedure before the cursor, it fails. Is there a requirement for cursors to be declared before procedures?
What other rules exist for the declaration order in the pl / sql block?
It works:
DECLARE
cursor cur is select 1 from dual;
procedure foo as begin null; end foo;
BEGIN
null;
END;
Error with error PLS-00103: Encountered the symbol "CURSOR" when expecting one of the following: begin function package pragma procedure form
DECLARE
procedure foo as begin null; end foo;
cursor cur is select 1 from dual;
BEGIN
null;
END;
source
share