Friday, 25 May 2012

How can you force FOR-LOOP to end unconditionally? | PL SQL

The EXIT statement can be used to end a FOR-LOOP unconditionally, as shown in the following code snippet:
FOR i in 1..100
FETCH Cursor_empINTO emp_rec;
EXIT WHENCURSOR_EMP%notfound;   //Exit will end the LOOP when condition is TRUE
Statement......
END LOOP;