Peace be with you all,
Why is it that you can't declare a variable after a local function
or procedure definition (within a stand-alone script)?
This fails:
declare
procedure impeachBush
is
begin
dbms_output.put_line( 'pardon my frustration' );
end;
n int;
begin
impeachBush();
n := 1;
end;
This is the error:
ORA-06550: line 8, column 4:
PLS-00103: Encountered the symbol "N" when expecting one of the following:
begin function package pragma procedure form
But, if I put the 'n int;' above the procedure, everything is ok, as such:
declare
n int;
procedure impeachBush
is
begin
dbms_output.put_line( 'pardon my frustration' );
end;
begin
impeachBush();
n := 1;
end;
The reason I'd rather have some of my variables defined below
my procedure and function definitions is to ensure that the vars
are not referenced by the procedures and functions. As well,
I'd rather not have to declare a nested declare/begin/end block
within the begin/end block of the script.
And, believe it or not, I do spend a lot of time reading the SQL,
PL/SQL and Database Reference manuals, and if someone can
point me to where the declaration semantics are defined, I'd be
very appreciative.
Kind Regards,
Robert