Procedural Constructs
Compound Statements
Refers to a set of SQL statements written between begin and end.
Loops
while
declare n integer default 0;
while n < 10 do
set n = n + 1
end whilerepeat
repeat
set n = n – 1
until n = 0
end repeatfor
Permits iteration over all results of a query.
For example:
leave is used to exit the loop
iterate starts from the next tuple
Conditional Constructs
SQL also supports conditional constructs such as if-then-else and case.
Exception Handling
Example:
exit is the handler; it causes the block enclosed by begin..end to be exited.
Last updated
Was this helpful?