
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
64 lines
1.1 KiB
Plaintext
64 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Labeled loops are useful, especially when the code is badly indented, to match the begin and end of each loop. However, those labels, if used, must appear on the same line as the "END" keyword in order to avoid any confusion. Indeed, the label might otherwise be seen as a procedure call.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,sql]
|
|
----
|
|
SET SERVEROUTPUT ON
|
|
|
|
DECLARE
|
|
PROCEDURE foo AS
|
|
BEGIN
|
|
DBMS_OUTPUT.PUT_LINE('foo was called!');
|
|
END;
|
|
BEGIN
|
|
LOOP
|
|
EXIT;
|
|
END LOOP -- The semicolon was forgotten
|
|
|
|
foo; -- Noncompliant, This is interpreted as a label of the previous FOR loop, not as a procedure call to foo!
|
|
|
|
END;
|
|
/
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,sql]
|
|
----
|
|
SET SERVEROUTPUT ON
|
|
|
|
DECLARE
|
|
PROCEDURE foo AS
|
|
BEGIN
|
|
DBMS_OUTPUT.PUT_LINE('foo was called!');
|
|
END;
|
|
BEGIN
|
|
|
|
<<myLoopLabel>>
|
|
LOOP
|
|
EXIT;
|
|
END LOOP myLoopLabel;
|
|
|
|
foo; -- Correctly interpreted as a procedure call to foo
|
|
END;
|
|
/
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Add a semicolon to the end of this statement.
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|