Re: breaking out of a loop in plpgsql - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: breaking out of a loop in plpgsql
Date
Msg-id 1118339470.27924.11.camel@localhost.localdomain
Whole thread Raw
In response to breaking out of a loop in plpgsql  ("Celia McInnis" <celia@drmath.ca>)
List pgsql-novice
On Thu, 2005-06-09 at 12:35 -0500, Celia McInnis wrote:
> How do I break out of a loop in plpgsql?

From the plpgsql docs:

        EXIT [ label ] [ WHEN expression ];

        If no label is given, the innermost loop is terminated and the
        statement following END LOOP is executed next. If label is
        given, it must be the label of the current or some outer level
        of nested loop or block. Then the named loop or block is
        terminated and control continues with the statement after the
        loop's/block's corresponding END.

        If WHEN is present, loop exit occurs only if the specified
        condition is true, otherwise control passes to the statement
        after EXIT.

        EXIT can be used to cause early exit from all types of loops; it
        is not limited to use with unconditional loops.




pgsql-novice by date:

Previous
From: "Celia McInnis"
Date:
Subject: breaking out of a loop in plpgsql
Next
From: "Daniel T. Staal"
Date:
Subject: Function debugging question