Home

Functions should end with RETURN statements

Rule description

  • Functions should end with RETURN statements

 

Non-compliant Code Example

function GetCompleteCustomerDetails(FirstName in nvarchar2,
LastName in nvarchar2,
ADDRESS1 in nvarchar2,
ADDRESS2 in nvarchar2,
Area in nvarchar2,
City in nvarchar2)return nvarchar2    
IS
BEGIN
	RETURN(CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(FirstName,LastName),CONCAT(ADDRESS1,ADDRESS2)),CONCAT(Area,City)))))); 
	
	CONCAT(CONCAT(ADDRESS1,ADDRESS2),CONCAT(Area,City));        --Non compliant code (Functions is not ending with RETURN statements)
	
END GetCompleteCustomerDetails

Compliant Code Example

function GetCompleteCustomerDetails(FirstName in nvarchar2,
LastName in nvarchar2,
ADDRESS1 in nvarchar2,
ADDRESS2 in nvarchar2,
Area in nvarchar2,
City in nvarchar2)return nvarchar2    
IS
BEGIN

	RETURN(CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(CONCAT(FirstName,LastName),CONCAT(ADDRESS1,ADDRESS2)),CONCAT(Area,City))))));  --Compliant code (Functions is ending with RETURN statements)
	
END GetCompleteCustomerDetails
Visual Expert 2020
 VEPLSQLRULE30