Using the same name for multiple purposes reduces the understandability of the code and might eventually lead to bugs.

This rule verifies that no name is reused in an inner scope.


== Noncompliant Code Example

----
<<foo>>                                    -- Compliant
DECLARE
  a CONSTANT PLS_INTEGER := 0;
BEGIN
  <<foo>>                                  -- Non-Compliant
  DECLARE
    b CONSTANT PLS_INTEGER := 42;
  BEGIN
    DBMS_OUTPUT.PUT_LINE('x = ' || foo.b); -- Confusing
  END;
END;
/
----


== Compliant Solution

----
<<foo>>                                    -- Compliant
DECLARE
  a CONSTANT PLS_INTEGER := 0;
BEGIN
  <<bar>>                                  -- Compliant
  DECLARE
    b CONSTANT PLS_INTEGER := 42;
  BEGIN
    DBMS_OUTPUT.PUT_LINE('x = ' || bar.b); -- Clear
  END;
END;
/
----



ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
