LOOP statement (PL/SQL)
The LOOP statement executes a sequence of statements within a PL/SQL code block multiple times.
Invocation
This statement can be embedded in a PL/SQL procedure, function, or anonymous block statement.
Authorization
No privileges are required to invoke the LOOP statement. However, the authorization ID of the statement must hold the necessary privileges to invoke the SQL statements that are embedded within the LOOP statement.
Syntax
Description
- statements
- Specifies one or more PL/SQL or SQL statements. These statements are executed during each iteration of the loop.
Example
The following example shows a basic
LOOP statement within an anonymous block:
DECLARE
sum INTEGER := 0;
BEGIN
LOOP
sum := sum + 1;
IF sum > 10 THEN
EXIT;
END IF;
END LOOP;
END 