In this article, you will learn how to use PostgreSQL while loop statement to execute statements as long as a condition is true.
Here’s the basic syntax of a while loop statement:
1 2 3 | while condition loop statements; end loop; |
The following example uses the while loop statement to display the value of a counter: