Loop labels- iterative control, PL-SQL Programming

Loop Labels

Like the PL/SQL blocks, loops can also be labeled. The label, an undeclared identifier enclosed by double angle brackets, should appear at the beginning of the LOOP statement, as shown:

<>
LOOP
sequence_of_statements
END LOOP;

Optionally, the label name can also come out at the end of the LOOP statement, as the illustration below shows:

<>
LOOP
...
END LOOP my_loop;


If you nest labeled loops, you can use the ending label names to improve the readability. With either form of the EXIT statement, you cannot complete only the current loop, but also any of the enclosing loops. Merely, label the enclosing loop that you want to done. Then, use the label in an EXIT statement, as shown:

<>
LOOP
...
LOOP
...
EXIT outer WHEN ... -- exit both loops
END LOOP;
...
END LOOP outer;

Posted Date: 10/3/2012 5:49:01 AM | Location : United States







Related Discussions:- Loop labels- iterative control, Assignment Help, Ask Question on Loop labels- iterative control, Get Answer, Expert's Help, Loop labels- iterative control Discussions

Write discussion on Loop labels- iterative control
Your posts are moderated
Related Questions
EXECUTE Privilege To call an invoker-rights routine straightforwardly, the users should have the EXECUTE privilege on that routine. By yielding the privilege, you permit a user

Variable Declaration - SQL SQL's support for variables is very similar to Tutorial D's, except that the syntax for creating persistent  variables-base tables-is quite differen

a. Write an anonymous block that contains a PL/SQL function. Given an order number orderNo, the function will calculate the total number of the parts in the order. Then the anonym

Project Description: I want a small relational database to be built. I want the database to have the subsequent information tables: Employee Information Document storage

Using RENAME in combination with JOIN - SQL Example gives pairs of ids of students having the same name, by joining two renamings of IS_CALLED. Example gives an equivalent ex

Autonomous versus Nested Transactions Though an autonomous transaction is started by the other transaction, it is not a nested transaction for the reasons shown below: (i)

Example of UNWRAP Operator - SQL Example here shows how unwrapping can be done in longhand in SQL. Example: Unwrapping in SQL Letting CONTACT_INFO_WRAPPED denote the res

Need Database Development with Analysis Tools Project Description: I want a database for large governmental and private data sets on one country that can be simply extended t

Overriding Default Locking By default, the Oracle locks the data structures for you automatically. Though, you can request exact data locks on rows or tables when it is to you

Create a Oracle procedure to produce vertical output format when selecting rows from a database table.