Order of declaration in an anonymous pl/sql block
- by RenderIn
I have an anonymous pl/sql block with a procedure declared inside of it as well as a cursor.  If I declare the procedure before the cursor it fails.  Is there a requirement that cursors be declared prior to procedures?
What other rules are there for order of declaration in a pl/sql block?
This works:
DECLARE
 cursor cur is select 1 from dual;
 procedure foo as begin null; end foo;
BEGIN
 null;
END;
This fails 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;