May 2020
Beginner
564 pages
14h 9m
English
PostgreSQL has IF/ELSE, CASE, and LOOP and WHILE statements for flow control options. For the IF/ELSE example we used in MySQL, you would need to use a CASE statement in PostgreSQL.
The LOOP statement in PostgreSQL is similar to the REPEAT statement in MySQL and uses the following syntax:
[looplabel]LOOPsql statements go here; EXIT [looplabel] WHEN condition; END LOOP;
The WHILE statement in PostgreSQL, which is very similar to the WHILE statement in MySQL, uses the following syntax:
[whilelabel]WHILE condition LOOPsql statements go here; END LOOP;
For more information about PostgreSQL flow control, take a look at the Further reading section.
Read now
Unlock full access