Home

END statements of labeled loops should be labeled

Rule description

  • END statements of labeled loops should be labeled

 

Non-compliant Code Example

BEGIN
	<<ForLoopOnCustomer>>
	FOR i IN 1 .. CUSTOMER_TABLE.COUNT          --Non compliant code (END statements of labeled loops is not labeled)
		LOOP
			IF CUSTOMER_TABLE(i) IS NOT NULL THEN
				DBMS_OUTPUT.PUT( i || ' = (' || CUSTOMER_TABLE(i).Name || ', ' || CUSTOMER_TABLE(i).PhoneNumber || ')' );
			ELSE
				DBMS_OUTPUT.PUT( i || ' IS NULL' );
			END IF;
		END LOOP;
	COMMIT;
END;

Compliant Code Example

BEGIN
	<<ForLoopOnCustomer>>
	FOR i IN 1 .. CUSTOMER_TABLE.COUNT       --Compliant code (END statements of labeled loops is labeled)
		LOOP
			IF CUSTOMER_TABLE(i) IS NOT NULL THEN
				DBMS_OUTPUT.PUT( i || ' = (' || CUSTOMER_TABLE(i).Name || ', ' || CUSTOMER_TABLE(i).PhoneNumber || ')' );
			ELSE
				DBMS_OUTPUT.PUT( i || ' IS NULL' );
			END IF;
		END LOOP ForLoopOnCustomer;
	COMMIT;
END;
Visual Expert 2020
 VEPLSQLRULE80