Home

PACKAGE BODY initialization sections should not contain RETURN statements

Rule description

  • PACKAGE BODY initialization sections should not contain RETURN statements

 

Non-compliant Code Example

CREATE OR REPLACE PACKAGE BODY CUSTOMER_PACKAGE 
AS
 	function GetCompleteCustomerDetails(customerId In INTEGER)
		return CUSTOMER_T 
		Is
		BEGIN
			Select FIRSTNAME, LASTNAME, AREA, CITY Into CUSTOMER_T.FirstName, CUSTOMER_T.LastName, CUSTOMER_T.Area, CUSTOMER_T.City FROM CUSTOMERS Where Id = customerId;
			RETURN CUSTOMER_T; 
	END GetCompleteCustomerDetails;

	BEGIN
		DBMS_OUTPUT.PUT('Loading  CUSTOMER_PACKAGE');
		RETURN;         --Non compliant code (PACKAGE BODY initialization sections contain RETURN statements)
		DBMS_OUTPUT.PUT('Junk code CUSTOMER_PACKAGE');
		Select FIRSTNAME, LASTNAME, AREA, CITY FROM CUSTOMERS;
END CUSTOMER_PACKAGE
Visual Expert 2020
 VEPLSQLRULE55