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!

BEGIN ... END LOOP - Why this should work ?

Maheshsg17Aug 8 2017 — edited Aug 9 2017

I was doing code review and found in procedure one of the block was ended using "END LOOP" instead of  "END" . My first impression was procedure should fail during compilation but I was wrong, then thought it should fail while executing but again I was wrong. Can some one help me to understand how ORACLE skips "END LOOP" and compiles or execute without any error.

Example -

begin

    begin

        for i in 1..5

        loop

        dbms_output.put_line(i);

        end loop;

    end loop;

end;

Output -

1

2

3

4

5

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2017
Added on Aug 8 2017
16 comments
886 views