Home

Procedures should have parameters

Description

    The rule that "Procedures should have parameters" states that when creating a procedure in PL/SQL, it should include parameters. Parameters are variables that are passed to the procedure when it is called. They can be used to provide input to the procedure, and they can also be used to return values from the procedure. By using parameters, a procedure can be more flexible and reusable. It can be used in different contexts and can be called with different values. This makes it easier to maintain and debug, and it also makes it easier to use the procedure in different applications.

Key Benefits

  • Easier to maintain: Procedures with parameters are easier to maintain as they can be reused and modified without having to rewrite the entire procedure.
  • More efficient: Parameters can be used to pass values to the procedure, making it more efficient and reducing the need for multiple procedures.
  • More secure: Parameters can be used to restrict access to the procedure, making it more secure.

 

Non-compliant Code Example

procedure DeleteCloneCustomerNon compliant code
As
BEGIN 
	DELETE CloneCustomer Where Name = 'Demo';
	COMMIT;
END DeleteCloneCustomer;

Compliant Code Example

procedure DeleteCloneCustomer(customerName In varchar2)Compliant code
As
BEGIN 
	DELETE CloneCustomer Where Name = customerName;
	COMMIT;
END DeleteCloneCustomer;
Visual Expert 2024
 VEPLSQLRULE77