Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exiting IF's and Nested IF's but staying in the Loop

12thMonkeyJul 25 2008 — edited Jul 25 2008
Hi Guys,

I am using Oracle Database 10g Enterprise Edition Release 10.2.0.3.0

I have a very long procedure partially outlined below

Cursor Retrieves records.
LOOP
IF condition is true THEN
IF condition is true THEN
do something
ELSIF condition is true THEN -- [LABLE]
do something
ELSIF condition is true THEN
do something
END IF
ELSIF condition is true THEN
IF condition is true THEN
do something
ELSIF condition is true THEN
do something
ELSIF condition is true THEN
do something
END IF
END IF;

..........

LOOP

I have been told that even if, for example, the second nested if [LABLE] is met the procedure will continue to perform checks on all remaining IF statements even though there would subsequently be no need.

Is there a way of getting the procedure, once the correct IF criteria has been met, to return to the start of the loop.

I have searched the forum but can only seem to find scripts for exiting loops, which i do not want to do here until the cursor has processed its last row.

Any advice would be appreciated.

thank you

G
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2008
Added on Jul 25 2008
8 comments
589 views