From An Expert's Guide to Oracle Technology Do you label your blocks? I don't normally but it is a standard in my current job. No, I don't normally create standards I don't use but it was in place when I got here. I don't like it and I don't like enforcing it. I do, as it's part of my job. Just don't like it. To make sure we're all on the same page, let me explain how you label a block. An anonymous block is a piece of PL/SQL that does not name its scope. For example, a pl/sql script can be an anonymous block.

DECLARE
 v_var NUMBER;
BEGIN
 v_var := do_a_thing(12345);

 FOR i IN 1..v_var
 LOOP
  say_howdy;
 END LOOP;

END;

The code above is an anonymous block. If I wanted to name it, I could turn it into a procedure but then it would actually be stored in the database. The upside to that is that it would also be compiled. Let's say I don't want to create a procedure but I do want to name it. I can do this:

<<thisisablock>>
DECLARE
 v_var NUMBER;
BEGIN
 v_var := do_a_thing(12345);

 FOR i IN 1..v_var
 LOOP
  say_howdy;
 END LOOP;

END thisisablock;

The label after the final END is optional. If you're going to go through the trouble of labeling your blocks, you might as well label the end too. Now I don't have an issue with labeling your block. I don't like making it a requirement. What does it contribute to maintainability? None as far as I am concerned. You can also name nested blocks. For example, the FOR LOOP in the above code can also be labeled.

<<thisisablock>>
DECLARE
 v_var NUMBER;
BEGIN
 v_var := do_a_thing(12345);

 <<thisisaforloop>>
 FOR i IN 1..v_var
 LOOP
  say_howdy;
 END LOOP thisisaforloop;

END thisisablock;

Ok, now you have a named for loop. The benefit? Nada. So why make it a standard? I don't know. I don't have a good answer for that except that it makes the code nice and wordy and harder to read. If you have nested FOR LOOPs, you can use the labels to EXIT them. I think there is usually a design flaw when that is required. It's kind of like a nasty GOTO. Do you use labels? Do you require it or are you required to do so? Why? What am I missing here? Thanks, LewisC