LEAVE statement
The LEAVE statement can be used to jump out of a loop or a compound statement.
If the loop or compound statement is nested you should explicit specify the label you want to leave.
Example:
create procedure leave (in var01 integer, out var02 integer) begin declare i integer default 0; my_loop: loop if i = var01 then leave my_loop; else set i = i + 1; end if; end loop; set var02 = i; end!
Link to the DB2 Information Center: DB2 9.7 DB2 10.1 DB2 10.5