Home

Statements should be on separate lines

Rule description

  • Statements should be on separate lines

 

Non-compliant Code Example

DECLARE
	NO_DATA_FOUND EXCEPTION;

BEGIN
	FOR i IN 1 .. CUSTOMER_TABLE.COUNT
		LOOP
			IF CUSTOMER_TABLE(i) IS NOT NULL THEN
				DBMS_OUTPUT.PUT( i || ' = (' || CUSTOMER_TABLE(i).Name || ', ' || CUSTOMER_TABLE(i).PhoneNumber || ')' );
			END IF;
		END LOOP;
EXCEPTION
  WHEN NO_DATA_FOUND THEN
	Log_Errors ( 'No data found');
  WHEN ERRORS THEN
	Log_Errors ( 'Error Log...' || Chr(10) || DBMS_UTILITY.FORMAT_ERROR_STACK() );   Log_Errors ( 'Error Log...' || Chr(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE() );   DBMS_OUTPUT.PUT_LINE ( '----------' ); --Non compliant code (Statements are in the same line)
    RAISE;
END CUSTOMER_TABLE_ITERATION;

Compliant Code Example

DECLARE
	NO_DATA_FOUND EXCEPTION;

BEGIN
	FOR i IN 1 .. CUSTOMER_TABLE.COUNT
		LOOP
			IF CUSTOMER_TABLE(i) IS NOT NULL THEN
				DBMS_OUTPUT.PUT( i || ' = (' || CUSTOMER_TABLE(i).Name || ', ' || CUSTOMER_TABLE(i).PhoneNumber || ')' );
			END IF;
		END LOOP;
EXCEPTION
  WHEN NO_DATA_FOUND THEN
	Log_Errors ( 'No data found');
  WHEN ERRORS THEN
	Log_Errors ( 'Error Log...' || Chr(10) || DBMS_UTILITY.FORMAT_ERROR_STACK() ); --Compliant code (Statements are in the separate line)
    Log_Errors ( 'Error Log...' || Chr(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE() );
    DBMS_OUTPUT.PUT_LINE ( '----------' );
    RAISE;
END CUSTOMER_TABLE_ITERATION;
Visual Expert 2020
 VEPLSQLRULE170