Labeled blocks are useful to help maintainers match-up the beginning and ending of each section of code, especially when that code is badly
indented. However, if used, those labels must appear on the same line as the "END" keyword in order to avoid confusion. Otherwise, the label might be
misread by maintainers as a procedure call.
Noncompliant code example
SET SERVEROUTPUT ON
DECLARE
PROCEDURE foo AS
BEGIN
DBMS_OUTPUT.PUT_LINE('foo was called!');
END;
BEGIN
BEGIN
NULL;
END -- Semicolon was forgotten?
foo; -- Noncompliant; looks like a procedure call, but is actually END block label
<<myBlockLabel>>
BEGIN
NULL;
END
myBlockLabel; -- Noncompliant
END;
/
Compliant solution
SET SERVEROUTPUT ON
DECLARE
PROCEDURE foo AS
BEGIN
DBMS_OUTPUT.PUT_LINE('foo was called!');
END;
BEGIN
BEGIN
NULL;
END;
foo; -- The method "foo" was actually meant to be called
<<myBlockLabel>>
BEGIN
NULL;
END myBlockLabel;
END;
/