Skip site navigation (1) Skip section navigation (2)

Re: breaking out of a loop in plpgsql

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Celia McInnis <celia(at)drmath(dot)ca>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: breaking out of a loop in plpgsql
Date: 2005-06-09 17:51:10
Message-ID: 1118339470.27924.11.camel@localhost.localdomain (view raw, whole thread or download thread mbox)
Lists: 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. 

In response to

pgsql-novice by date

Next:From: Daniel T. StaalDate: 2005-06-09 18:56:47
Subject: Function debugging question
Previous:From: Celia McInnisDate: 2005-06-09 17:35:24
Subject: breaking out of a loop in plpgsql

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group