Re: Nested blocks in PL/SQL

From: Tony <andrewst_at_onetel.net.uk>
Date: 9 Feb 2004 13:29:01 -0800
Message-ID: <c0e3f26e.0402091329.37a370e0_at_posting.google.com>


mourad_barakat_at_yahoo.com (Mourad) wrote in message news:<6554b826.0402090745.1fa0b6c5_at_posting.google.com>...
> Mark, you are right.. here is a paste from the sqlplus screen:
>
>
>
> SQL> declare
> 2
> 3 begin
> 4
> 5 declare
> 6
> 7 begin
> 8
> 9 end;
> 10
> 11 end;
> 12 /
> end;
> *
> ERROR at line 9:
> ORA-06550: line 9, column 2:
> PLS-00103: Encountered the symbol "END" when expecting one of the following:
> begin case declare exit for goto if loop mod null pragma
> raise return select update while with <an identifier>
> <a double-quoted delimited-identifier> <a bind variable> <<
> close current delete fetch lock insert open rollback
> savepoint set sql execute commit forall merge
> <a single-quoted SQL string> pipe

You are not allowed to create a BEGIN/END block with NO executable statements in it. At the very least you should put a "null;" statement in there:

declare
begin

   declare
   begin

      null;
   end;
end;
/

(The "declare" keywords are redundant also unless you actually declare variables, but do not cause a syntax error.) Received on Mon Feb 09 2004 - 22:29:01 CET

Original text of this message