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
Fetching with a Cursor The FETCH statements retrieve the rows in the result set one at a time. After each and every fetch, the cursor advance to the next row in the result set

Advantages of PL/SQL The PL/SQL is a high-performance transaction processing, completely portable language that offers the following advantages as shown: 1) Support for SQL

Example of Foreign Key Constraint Example: Alternative formulation for 6.3 as a foreign key constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Must_be_enrolled_to_take_exam

Example of Shorthand for a row constraint Example: Shorthand for a row constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Mark_in_range CHECK (Mark BETWEEN 0 AND 100);

Creating a Table Syantax: CREATE TABLE ENROLMENT (StudentId SID, Name   VARCHAR (30) NOT NULL, CourseId CID, PRIMARY KEY (StudentId, CourseId)) ; Explan

Write a program to implement the inverted file shown in the slides (Simple Index file, LabelID file and Data file).  Use the Avail_List to point at the deleted Label IDs so that th

CURRVAL and NEXTVAL The series is a schema object which generates the sequential numbers. Whenever you form a sequence, you can specify its primary value and an increment. T

Count Operator in SQL Example: Counting the students who have scored more than 50 in some exam (SELECT COUNT (*) FROM (SELECT DISTINCT StudentId FROM EXAM_MARK WHE

Parameter and Keyword Description: dynamic_string: This is a string variable, literal, or expression which represents a SQL statement or the PL/SQL block. define_vari

#quesWrite a cursor to open an employee database and fetch the employee record whose age is greater than 45.tion..