sequence of statements as long as the evaluation of
sequence of statements so long as the condition expression
the condition expression is true.
evaluates to true. The condition is checked just before
each entry to the loop body.
<synopsis>
<synopsis>
<optional><<label>></optional>
<optional><<label>></optional>
WHILE <replaceable>expression</replaceable> LOOP
WHILE <replaceable>expression</replaceable> LOOP
...
@@ -1130,6 +1298,7 @@ END LOOP;
...
@@ -1130,6 +1298,7 @@ END LOOP;
<listitem>
<listitem>
<para>
<para>
<synopsis>
<synopsis>
<optional><<label>></optional>
<optional><<label>></optional>
FOR <replaceable>name</replaceable> IN <optional> REVERSE </optional> <replaceable>expression</replaceable> .. <replaceable>expression</replaceable> LOOP
FOR <replaceable>name</replaceable> IN <optional> REVERSE </optional> <replaceable>expression</replaceable> .. <replaceable>expression</replaceable> LOOP
...
@@ -1139,14 +1308,13 @@ END LOOP;
...
@@ -1139,14 +1308,13 @@ END LOOP;
A loop that iterates over a range of integer values. The variable
A loop that iterates over a range of integer values. The variable
<replaceable>name</replaceable> is automatically created as type
<replaceable>name</replaceable> is automatically created as type
integer and exists only inside the loop. The two expressions giving
integer and exists only inside the loop. The two expressions giving
the lower and upper bound of the range are evaluated only when entering
the lower and upper bound of the range are evaluated once when entering
the loop. The iteration step is always 1.
the loop. The iteration step is normally 1, but is -1 when REVERSE is
specified.
</para>
</para>
<para>
<para>
Some examples of FOR loops (see <xref
Some examples of integer FOR loops:
linkend="plpgsql-description-records"> for iterating over
records in FOR loops):
<programlisting>
<programlisting>
FOR i IN 1..10 LOOP
FOR i IN 1..10 LOOP
-- some expressions here
-- some expressions here
...
@@ -1162,129 +1330,24 @@ END LOOP;
...
@@ -1162,129 +1330,24 @@ END LOOP;
</listitem>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</variablelist>
</sect3>
</sect2>
<!-- **** PL/pgSQL records **** -->
<sect2 id="plpgsql-description-records">
<title>Working with RECORDs</title>
<para>
Records are similar to rowtypes, but they have no predefined structure.
They are used in selections and FOR loops to hold one actual