469,600 Members | 2,393 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

Nested blocks in PL/SQL

Hi all,

This is an example of a nested block, however it seems Oracle doesn't
like the syntax. see the error below:

declare
begin
declare
begin

end; -- <<< causes error!! any idea
end;

ERROR at line 5:
ORA-06550: line 5, column 7:
PLS-00103: Encountered the symbol "EXCEPTION" 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

Thanks in advance,

Mourad
Jul 19 '05 #1
3 23717
"Mourad" <mo************@yahoo.com> wrote in message
news:65**************************@posting.google.c om...
| Hi all,
|
| This is an example of a nested block, however it seems Oracle doesn't
| like the syntax. see the error below:
|
| declare
| begin
| declare
| begin
|
| end; -- <<< causes error!! any idea
| end;
|
| ERROR at line 5:
| ORA-06550: line 5, column 7:
| PLS-00103: Encountered the symbol "EXCEPTION" 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
|
|
|
| Thanks in advance,
|
| Mourad

you'll need to post the actual code that caused the error, what you posed
does not show what is actually happening (ie, the error is on EXCEPTION, you
have no EXCEPTION in what you posted)
Jul 19 '05 #2
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
SQL>
Thanks,
Mourad


"Mark C. Stock" <mcstockX@Xenquery .com> wrote in message news:<86********************@comcast.com>...
"Mourad" <mo************@yahoo.com> wrote in message
news:65**************************@posting.google.c om...
| Hi all,
|
| This is an example of a nested block, however it seems Oracle doesn't
| like the syntax. see the error below:
|
| declare
| begin
| declare
| begin
|
| end; -- <<< causes error!! any idea
| end;
|
| ERROR at line 5:
| ORA-06550: line 5, column 7:
| PLS-00103: Encountered the symbol "EXCEPTION" 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
|
|
|
| Thanks in advance,
|
| Mourad

you'll need to post the actual code that caused the error, what you posed
does not show what is actually happening (ie, the error is on EXCEPTION, you
have no EXCEPTION in what you posted)

Jul 19 '05 #3
mo************@yahoo.com (Mourad) wrote in message news:<65**************************@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.)
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

25 posts views Thread by chad | last post: by
6 posts views Thread by Andy Baker | last post: by
reply views Thread by Dean H. Saxe | last post: by
2 posts views Thread by Quinnie | last post: by
46 posts views Thread by Neptune | last post: by
10 posts views Thread by nimmi_srivastav | last post: by
13 posts views Thread by Jonathan Amsterdam | last post: by
2 posts views Thread by cloc3 | last post: by
10 posts views Thread by Rahul | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.