March 2006
Intermediate to advanced
640 pages
17h 8m
English
In this chapter we looked at conditional and iterative control
structures in the MySQL stored program language. Almost any nontrivial
program will need to make some kind of decision based on input data,
and these decisions will usually be expressed as IF or CASE statements.
Looping is another extremely common programming task—especially
common in stored programs that need to iterate through the outputs
from some SQL statement. MySQL provides a number of alternative ways
to format a loop, including a simple loop terminated by a LEAVE statement, a REPEAT UNTIL loop, and a WHILE loop.