Home

Labels redefined in inner scopes

Rule description

  • Labels should not be re-defined in inner scopes

 

Non-compliant Code Example

DECLARE
   abc INTEGER;
BEGIN
<<outerloop>>
   DECLARE
      abc INTEGER;
	
   BEGIN <<outerloop>>      --Non compliant code (Labels is re-defined in inner scopes)
      IF abc = outerloop.abc THEN  -- refers to global abc
         NULL;
      END IF;
   END outerloop;
END outerloop;

Compliant Code Example

DECLARE
   abc INTEGER;
BEGIN
<<outerloop>>
   DECLARE
      abc INTEGER;
	
   BEGIN <<innerloop>>      --Compliant code (Labels is not re-defined in inner scopes)
      IF abc = outerloop.abc THEN  -- refers to global abc
         NULL;
      END IF;
   END innerloop;
END outerloop;
Visual Expert 2020
 VEPLSQLRULE1