11.70 doc
Posted in 2012
Topics: Stored Procedures & SPL
I copied this from 11.70 doc,
I can not understand the last statement( red),
An ON EXCEPTION statement is valid for the statement block that follows the
ON EXCEPTION statement, all the statement blocks nested within the
following statement block, and all the statement blocks that follow the ON
EXCEPTION statement. It is not valid in the statement block that contains
the ON EXCEPTION statement.
Why,
It is not valid in the statement block that contains the ON EXCEPTION
statement.
The example is clear, but, explanation is consistent ??
Thanks,
Frank
Programming<http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.
prognode.doc/prog.htm>>
SQL<http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.prognode
.doc/sql.htm>>
Guide
to SQL:
Tutorial<http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sql
t.doc/sqlt.htm>>
Create
and use SPL
routines<http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sql
t.doc/ids_sqt_412.htm>>
Exception
handling<http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sql
t.doc/ids_sqt_514.htm>
Scope of control of an ON EXCEPTION statement
An ON EXCEPTION statement is valid for the statement block that follows the
ON EXCEPTION statement, all the statement blocks nested within the
following statement block, and all the statement blocks that follow the ON
EXCEPTION statement. It is not valid in the statement block that contains
the ON EXCEPTION statement.
The following pseudocode shows where the exception is valid within the
routine. That is, if error 201 occurs in any of the indicated blocks, the
action labeled *a201* occurs.
Figure 1. ON EXCEPTION statement scope of control.
CREATE PROCEDURE scope()DEFINE i INT;
. . .
BEGIN -- begin statement block A
. . .
ON EXCEPTION IN (201)
-- do action a201
END EXCEPTION
BEGIN -- statement block aa
-- do action, a201 valid here
END
BEGIN -- statement block bb
-- do action, a201 valid here
END
WHILE i < 10
-- do something, a201 is valid here
END WHILE
END
BEGIN -- begin statement block B
-- do something
-- a201 is NOT valid here
END
END PROCEDURE;
*Parent topic:* Exception
handling<http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sql
t.doc/ids_sqt_514.htm>
--bcaec5485810de7a0204bc3c21f3
I have no idea what that means. Just ignore it. I KNOW that the
exceptions work in the block in which they are defined.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.
On Tue, Mar 27, 2012 at 12:39 PM, FRANK <yunyaoqu@gmail.com> wrote:
> I copied this from 11.70 doc,
>
> I can not understand the last statement( red),
>
> An ON EXCEPTION statement is valid for the statement block that follows the
> ON EXCEPTION statement, all the statement blocks nested within the
> following statement block, and all the statement blocks that follow the ON
> EXCEPTION statement. It is not valid in the statement block that contains
> the ON EXCEPTION statement.
>
> Why,
>
> It is not valid in the statement block that contains the ON EXCEPTION
> statement.
>
> The example is clear, but, explanation is consistent ??
>
> Thanks,
> Frank
>
>
> Programming<
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.prognode.doc
/prog.htm
> >>
>
> SQL<
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.prognode.doc
/sql.htm
> >>
> Guide
> to SQL:
> Tutorial<
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/sql
t.htm
> >>
> Create
> and use SPL
> routines<
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/ids
_sqt_412.htm
> >>
> Exception
>
> handling<
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/ids
_sqt_514.htm
> >
>
> Scope of control of an ON EXCEPTION statement
>
> An ON EXCEPTION statement is valid for the statement block that follows the
> ON EXCEPTION statement, all the statement blocks nested within the
> following statement block, and all the statement blocks that follow the ON
> EXCEPTION statement. It is not valid in the statement block that contains
> the ON EXCEPTION statement.
> The following pseudocode shows where the exception is valid within the
> routine. That is, if error 201 occurs in any of the indicated blocks, the
> action labeled *a201* occurs.
> Figure 1. ON EXCEPTION statement scope of control.
>
> CREATE PROCEDURE scope()> DEFINE i INT;
>
> .. . .
> BEGIN -- begin statement block A
>
> .. . .
>
> ON EXCEPTION IN (201)
>
> -- do action a201
>
> END EXCEPTION
>
> BEGIN -- statement block aa
>
> -- do action, a201 valid here
>
> END
>
> BEGIN -- statement block bb
>
> -- do action, a201 valid here
>
> END
>
> WHILE i < 10
>
> -- do something, a201 is valid here
>
> END WHILE
>
> END
> BEGIN -- begin statement block B
>
> -- do something
>
> -- a201 is NOT valid here
> END
> END PROCEDURE;
>
> *Parent topic:* Exception
>
> handling<
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/ids
_sqt_514.htm
> >
>
> --bcaec5485810de7a0204bc3c21f3
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--14dae9340a412dafeb04bc3d4dd3
FRANK Wrote: ============================================================================== I copied this from 11.70 doc, I can not understand the last statement( red), An ON EXCEPTION statement is valid for the statement block that follows the ON EXCEPTION statement, all the statement blocks nested within the following statement block, and all the statement blocks that follow the ON EXCEPTION statement. It is not valid in the statement block that contains the ON EXCEPTION statement. Why, It is not valid in the statement block that contains the ON EXCEPTION statement. The example is clear, but, explanation is consistent ?? Thanks, Frank ============================================================================== Response: The only explanation I can think of might be better phrased as... It is not valid in the statement block contained by the ON EXCEPTION statement. or It is not valid within the ON EXCEPTION statement itself or any statement blocks nested within the ON EXCEPTION statement. The why for this would be rather straight forward. Because it could lead to an infinite loop. This is only a guess. You may want to contact Tech Support for clarification. This might be a documentation bug.
Thanks, Art! I share your opinion. Frank
On Tue, Mar 27, 2012 at 2:03 PM, Art Kagel <art.kagel@gmail.com> wrote:
> I have no idea what that means. Just ignore it. I KNOW that the
> exceptions work in the block in which they are defined.
>
> Art
>
> Art S. Kagel
> Advanced DataTools (www.advancedatatools.com)
> Blog: http://informix-myview.blogspot.com/
>
> Disclaimer: Please keep in mind that my own opinions are my own opinions
> and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
> other organization with which I am associated either explicitly,
> implicitly, or by inference. Neither do those opinions reflect those of
> other individuals affiliated with any entity with which I am affiliated nor
> those of the entities themselves.
>
> On Tue, Mar 27, 2012 at 12:39 PM, FRANK <yunyaoqu@gmail.com> wrote:
>
> > I copied this from 11.70 doc,
> >
> > I can not understand the last statement( red),
> >
> > An ON EXCEPTION statement is valid for the statement block that follows
> the
> > ON EXCEPTION statement, all the statement blocks nested within the
> > following statement block, and all the statement blocks that follow the
> ON
> > EXCEPTION statement. It is not valid in the statement block that contains
> > the ON EXCEPTION statement.
> >
> > Why,
> >
> > It is not valid in the statement block that contains the ON EXCEPTION
> > statement.
> >
> > The example is clear, but, explanation is consistent ??
> >
> > Thanks,
> > Frank
> >
> >
> > Programming<
> >
>
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.prognode.doc
/prog.htm
> > >>
> >
> > SQL<
> >
>
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.prognode.doc
/sql.htm
> > >>
> > Guide
> > to SQL:
> > Tutorial<
> >
>
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/sql
t.htm
> > >>
> > Create
> > and use SPL
> > routines<
> >
>
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/ids
_sqt_412.htm
> > >>
> > Exception
> >
> > handling<
> >
>
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/ids
_sqt_514.htm
> > >
> >
> > Scope of control of an ON EXCEPTION statement
> >
> > An ON EXCEPTION statement is valid for the statement block that follows
> the
> > ON EXCEPTION statement, all the statement blocks nested within the
> > following statement block, and all the statement blocks that follow the
> ON
> > EXCEPTION statement. It is not valid in the statement block that contains
> > the ON EXCEPTION statement.
> > The following pseudocode shows where the exception is valid within the
> > routine. That is, if error 201 occurs in any of the indicated blocks, the
> > action labeled *a201* occurs.
> > Figure 1. ON EXCEPTION statement scope of control.
> >
> > CREATE PROCEDURE scope()> > DEFINE i INT;
> >
> > .. . .
> > BEGIN -- begin statement block A
> >
> > .. . .
> >
> > ON EXCEPTION IN (201)
> >
> > -- do action a201
> >
> > END EXCEPTION
> >
> > BEGIN -- statement block aa
> >
> > -- do action, a201 valid here
> >
> > END
> >
> > BEGIN -- statement block bb
> >
> > -- do action, a201 valid here
> >
> > END
> >
> > WHILE i < 10
> >
> > -- do something, a201 is valid here
> >
> > END WHILE
> >
> > END
> > BEGIN -- begin statement block B
> >
> > -- do something
> >
> > -- a201 is NOT valid here
> > END
> > END PROCEDURE;
> >
> > *Parent topic:* Exception
> >
> > handling<
> >
>
>
http://publib.boulder.ibm.com/infocenter/idshelp/v117/topic/com.ibm.sqlt.doc/ids
_sqt_514.htm
> > >
> >
> > --bcaec5485810de7a0204bc3c21f3
> >
> >
> >
> >
>
>
*******************************************************************************
> > Forum Note: Use "Reply" to post a response in the discussion forum.
> >
> >
>
> --14dae9340a412dafeb04bc3d4dd3
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--f46d04374a9ba4177904bc40783f
Hi, Dave, I seem to get even more confused after read your response ..... (sorry, this happens ...) I will have a sleep and rethink it after I get a clear mind :-) Thanks, Frank On Tue, Mar 27, 2012 at 5:33 PM, DAVE GRIFFEN <dgriffen@finishline.com>wrote: > FRANK Wrote: > > ============================================================================== > I copied this from 11.70 doc, > > I can not understand the last statement( red), > > An ON EXCEPTION statement is valid for the statement block that follows the > ON EXCEPTION statement, all the statement blocks nested within the > following statement block, and all the statement blocks that follow the ON > EXCEPTION statement. It is not valid in the statement block that contains > the ON EXCEPTION statement. > > Why, > > It is not valid in the statement block that contains the ON EXCEPTION > statement. > > The example is clear, but, explanation is consistent ?? > > Thanks, > Frank > > ============================================================================== > > Response: > The only explanation I can think of might be better phrased as... > > It is not valid in the statement block contained by the ON EXCEPTION > statement. > > or > > It is not valid within the ON EXCEPTION statement itself or any statement > blocks nested within the ON EXCEPTION statement. > > The why for this would be rather straight forward. Because it could lead > to an > infinite loop. > > This is only a guess. You may want to contact Tech Support for > clarification. > This might be a documentation bug. > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --bcaec5485810ef42f304bc408965