Subject Re: enhancement to procedure/trigger language
Author dianeb77@hotmail.com
--- In IB-Architect@y..., Jim Starkey <jas@n...> wrote:
> At 03:11 PM 6/6/01 -0400, Ann W. Harrison wrote:
> >
> >The underlying BLR has a label and leave structure that
> >allows the code to break out of specific loop levels.
> >What should we use for language? One suggestion is to
> >emulate the label/leave model. Another is to use the
> >C/Delphi style 'break'.
> >
>
> I'm rather partial to label/leave construct. It is the
> only construct I'm aware of that allows an exit from
> two loop levels without resorting to a dispicable "goto"
> (oh, it hurts even to type it in quotes).

[Speaking of hurting ...]

From SQL96 (Persistent Stored Modules):
"13.10 <leave statement>
Function
Continue execution by leaving labeled statement.
Format
<leave statement> ::=
LEAVE <statement label>

Syntax Rules
1) <statement label> shall be the <beginning label> of some <SQL
procedure statement> S that contains <leave statement> L without an
intervening <SQL-schema statement>.

<etc. etc.>"


> As far as I know, there isn't an accepted syntax for
> labeled blocks. The obvious candidate is:
>
> statement := <label> : <statement>
> label := <identifier>


More excerpts from SQL96:

"<beginning label> ::= <statement label>
<ending label> ::= <statement label>
<statement label> ::= <identifier>

<loop statement> ::=
[ <beginning label> <colon> ]
LOOP
<SQL statement list>
END LOOP [ <ending label> ]

<while statement> ::=
[ <beginning label> <colon> ]
WHILE <search condition> DO
<SQL statement list>
END WHILE [ <ending label> ]

<repeat statement> ::=
[ <beginning label> <colon> ]
REPEAT
<SQL statement list>
UNTIL <search condition>
END REPEAT [ <ending label> ]
<...>

<for statement> ::=
[ <beginning label> <colon> ]
FOR <for loop variable name> AS
[ <cursor name> [ INSENSITIVE ] CURSOR FOR ]
<cursor specification>
DO <SQL statement list>
END FOR [ <ending label> ]

<compound statement> ::=
[ <beginning label> <colon> ]
BEGIN [ [ NOT ] ATOMIC ]
[ <local declaration list> ]
[ <local cursor declaration list> ]
[ <local handler declaration list> ]
[ <SQL statement list> ]
END [ <ending label> ]

<blah blah blah>"


db