473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 23930
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: chad | last post by:
I am writing a program to do some reliability calculations that require several nested for-loops. However, I believe that as the models become more complex, the number of required for-loops will...
6
by: Andy Baker | last post by:
Hi there, I'm learning Python at the moment and trying to grok the thinking behind it's scoping and nesting rules. I was googling for nested functions and found this Guido quote:...
0
by: Dean H. Saxe | last post by:
I'm currently developing a tool in perl to search out potential XSS (Cross Site Scripting) vulnerabilities and correct them in a ColdFusion based web app. I've been having great success so far,...
2
by: Quinnie | last post by:
Hi, I have a homework assignment that I'm so confused and really need help with. Here's the description, any help would be appreciated. Thanks! Assume we have a statically-scoped language...
46
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are...
10
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our...
11
by: Alfonso Morra | last post by:
Hi, I have the ff data types : typedef enum { VAL_LONG , VAL_DOUBLE , VAL_STRING , VAL_DATASET }ValueTypeEnum ;
13
by: Jonathan Amsterdam | last post by:
I think there's a slight design flaw in the Queue class that makes it hard to avoid nested monitor deadlock. The problem is that the mutex used by the Queue is not easy to change. You can then...
2
by: cloc3 | last post by:
I'm a newbie in python, and I'm fighting against nested blocks in psp. Thats a little example with a funny behaviour: <html> <form> <select name="List"> <!--makes a list with a loop --> <%...
10
by: Rahul | last post by:
Hi Everyone, I was wondering about the nested comments and the reason why it is not acceptable... /* first /* second */
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.