Home

The RELIES_ON clause should not be used

Rule description

  • The RELIES_ON clause should not be used

 

Non-compliant Code Example

CREATE OR REPLACE FUNCTION GetCustomerPhoneNumber (customerId IN INTEGER)
  RETURN NUMBER
  RESULT_CACHE RELIES_ON (CUSTOMERS)            --Non compliant code (The RELIES_ON clause is used)
AS
  phone_number CUSTOMERS.PHONE_NUMBER%TYPE;
BEGIN
  SELECT PHONE_NUMBER
  INTO   phone_number
  FROM   CUSTOMERS
  WHERE  Id = customerId;
  
  DBMS_LOCK.sleep(2);
  
  RETURN phone_number;
END GetCustomerPhoneNumber;

Compliant Code Example

CREATE OR REPLACE FUNCTION GetCustomerPhoneNumber (customerId IN INTEGER)
  RETURN NUMBER --Compliant code
AS
  phone_number CUSTOMERS.PHONE_NUMBER%TYPE;
BEGIN
  SELECT PHONE_NUMBER
  INTO   phone_number
  FROM   CUSTOMERS
  WHERE  Id = customerId;
  
  DBMS_LOCK.sleep(2);
  
  RETURN phone_number;
END GetCustomerPhoneNumber;
Visual Expert 2020
 VEPLSQLRULE187