2021-04-28 16:49:39 +02:00
|
|
|
Using the same name for multiple purposes reduces the understandability of the code and might eventually lead to bugs.
|
|
|
|
|
|
|
|
|
|
|
|
This rule verifies that no label is reused in an inner scope.
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2021-04-28 16:49:39 +02:00
|
|
|
== Noncompliant Code Example
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,sql]
|
2021-04-28 16:49:39 +02:00
|
|
|
----
|
|
|
|
<<foo>>
|
|
|
|
DECLARE
|
|
|
|
a CONSTANT PLS_INTEGER := 0;
|
|
|
|
BEGIN
|
|
|
|
<<foo>> -- Noncompliant
|
|
|
|
DECLARE
|
|
|
|
b CONSTANT PLS_INTEGER := 42;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.PUT_LINE('x = ' || foo.b); -- Confusing
|
|
|
|
END;
|
|
|
|
END;
|
|
|
|
/
|
|
|
|
----
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2021-04-28 16:49:39 +02:00
|
|
|
== Compliant Solution
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,sql]
|
2021-04-28 16:49:39 +02:00
|
|
|
----
|
|
|
|
<<foo>>
|
|
|
|
DECLARE
|
|
|
|
a CONSTANT PLS_INTEGER := 0;
|
|
|
|
BEGIN
|
|
|
|
<<bar>>
|
|
|
|
DECLARE
|
|
|
|
b CONSTANT PLS_INTEGER := 42;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.PUT_LINE('x = ' || bar.b);
|
|
|
|
END;
|
|
|
|
END;
|
|
|
|
/
|
|
|
|
----
|
2021-04-28 18:08:03 +02:00
|
|
|
|
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::message.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|