[Info-ingres] labels on a while statement

Martin Bowes martin.bowes at ndph.ox.ac.uk
Wed Jul 3 11:24:00 UTC 2019


Hi All,

>From the SQL manual:

A WHILE statement can be labeled. The label enables the ENDLOOP statement to break out of a
nested series of WHILE statements to a specified level. The label precedes WHILE and is
specified by a unique alphanumeric identifier followed by a colon, as in the following:
A: WHILE...
The label must be a legal object name...

So why is it that the label can only be a single alphanumeric character? Anything other than a single character causes a syntax error.

Eg: create procedure weird_label
as declare
    loop integer4 not null not default;
    msg varchar(256) not null not default;
begin
    loop = 0;
    Outer: while (:loop < 3) do
        msg = 'Loop ' + varchar(:loop);
        message :msg;
        loop = loop + 1;
    endwhile;
    msg = 'Finished with loop = ' + varchar(:loop);
    message :msg;
end;

E_US09C4 Syntax error on line 4.  Last symbol read was: 'Outer'.

Take the above procedure and replace label 'Outer' with 'O' and it will work.

Martin Bowes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.planetingres.org/pipermail/info-ingres/attachments/20190703/2ad7d54b/attachment.html>


More information about the Info-ingres mailing list