Home

The result_cache hint should be avoided

Rule description

  • The result_cache hint should be avoided

 

Non-compliant Code Example

CREATE OR REPLACE FUNCTION GetCustomerPhoneNumber (customerId IN INTEGER)
  RETURN NUMBER
  RESULT_CACHE RELIES_ON (CUSTOMERS)
AS
  phone_number CUSTOMERS.PHONE_NUMBER%TYPE;
BEGIN

  SELECT /*+ result_cache */  --Non compliant code (The result_cache hint is added)
	PHONE_NUMBER
  INTO   phone_number
  FROM   CUSTOMERS
  WHERE  Id = customerId;
  
  DBMS_LOCK.sleep(2);
  
  RETURN phone_number;
END GetCustomerPhoneNumber
Visual Expert 2020
 VEPLSQLRULE65