[Info-ingres] labels on a while statement

Martin Bowes martin.bowes at ndph.ox.ac.uk
Wed Jul 3 13:50:55 UTC 2019


Of course!

Thanks Roy.

Marty

-----Original Message-----
From: Roy Hann [mailto:specially at processed.almost.meat] 
Sent: 03 July 2019 14:44
To: info-ingres at lists.planetingres.org
Subject: Re: [Info-ingres] labels on a while statement

Martin Bowes wrote:

> 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.

The problem (I believe) is that OUTER is a keyword. They can often be
used for identifiers with impunity, but sometime not. 

This works:

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

--Roy
_______________________________________________
Info-ingres mailing list
Info-ingres at lists.planetingres.org
https://lists.planetingres.org/mailman/listinfo/info-ingres



More information about the Info-ingres mailing list