you are at >> pgSQL >>loops
Loops
infinite loop
[< < label > >]
LOOP
instructions
END LOOP ;
Example for loop which execute only 10 times
[< < loop10 > >]
LOOP i:i+1
EXIT loop10 WHEN i>=10;
END LOOP ;
This is the simplest type of loop, which can carry out indefinitely if you do not follow the EXIT instruction to end the loop. Defining name for loop helps specifying with EXIT command which loop has to be finished. If the label has not been determined, it will finishes the current loop.
WHILE loop
[< < loop > >]
WHILE condition
LOOP
instructions
END LOOP ;
FOR loop
[< < loop > >]
FOR name IN [REVERSE] from..to
LOOP
instructions
END LOOP;
[ wróć na górę strony ]