1

I was reviewing a colleague's code and found something similar below:

begin
    for i in (select 'x' from dual) loop
        null;
    end loop Y; 
end;

I can't understand why this compiles and runs. Shouldn't it fail because of the "Y" variable? I tried other variables as well but it compiles.

please advise.

Thank you.

1 Answer 1

3

These are just statement labels and exist to name a particular part of the program, it's not much different from the label you put after the begin end of a procedure to mark the end of the procedure.

For reference

Sign up to request clarification or add additional context in comments.

2 Comments

Your reference link is for MySQL, here's one for Oracle db: docs.oracle.com/en/database/oracle/oracle-database/21/lnpls/…
Silly me, thank you for the remark, adjusted it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.