Oracle 5.0 Reference Manual page 1163

Table of Contents

Advertisement

Example:
CREATE PROCEDURE doiterate(p1 INT)
BEGIN
label1: LOOP
SET p1 = p1 + 1;
IF p1 < 10 THEN
ITERATE label1;
END IF;
LEAVE label1;
END LOOP label1;
SET @x = p1;
END;
13.6.5.6.
Syntax
REPEAT
[begin_label:] REPEAT
statement_list
UNTIL
search_condition
END REPEAT [end_label]
The statement list within a
true. Thus, a
statements, each terminated by a semicolon (;) statement delimiter.
A
statement can be labeled. For the rules regarding label use, see
REPEAT
Label
Syntax".
Example:
mysql>
delimiter //
mysql>
CREATE PROCEDURE dorepeat(p1 INT)
->
BEGIN
->
SET @x = 0;
->
REPEAT
->
SET @x = @x + 1;
->
UNTIL @x > p1 END REPEAT;
->
END
->
//
Query OK, 0 rows affected (0.00 sec)
mysql>
CALL dorepeat(1000)//
Query OK, 0 rows affected (0.00 sec)
mysql>
SELECT @x//
+------+
| @x
|
+------+
| 1001 |
+------+
1 row in set (0.00 sec)
13.6.5.7.
Syntax
RETURN
RETURN
expr
The
RETURN
function caller. There must be at least one
than one if the function has multiple exit points.
This statement is not used in stored procedures or triggers. The
stored program of those types.
13.6.5.8.
Syntax
WHILE
[begin_label:] WHILE
statement_list
Flow Control Statements
statement is repeated until the
REPEAT
always enters the loop at least once.
REPEAT
statement terminates execution of a stored function and returns the value
search_condition
statement_list
statement in a stored function. There may be more
RETURN
DO
1143
search_condition
consists of one or more
Section 13.6.2, "Statement
expr
statement can be used to exit a
LEAVE
expression is
to the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents