Home
RESULT_CACHE should not be used
Description
The RESULT_CACHE rule states that the RESULT_CACHE hint should not be used in PL/SQL code. This is because the RESULT_CACHE hint can cause unexpected performance issues, and can lead to incorrect results. The RESULT_CACHE hint should only be used in very specific cases, and should be tested thoroughly before being used in production code.
Key Benefits
- Performance: RESULT_CACHE should not be used as it can lead to a performance decrease due to the overhead of caching and retrieving the data.
- Data Integrity: RESULT_CACHE should not be used as it can lead to data integrity issues due to the cached data not being up to date.
- Security: RESULT_CACHE should not be used as it can lead to security issues due to the cached data being accessible to all users.
Non-compliant Code Example
CREATE OR REPLACE FUNCTION generate_fibonacci (input_number NUMBER)
RETURN NUMBER
RESULT_CACHE --Non compliant code (RESULT_CACHE is used)
AUTHID DEFINER
IS
BEGIN
IF (input_number =0) OR (input_number =1) THEN
RETURN 1;
ELSE
RETURN generate_fibonacci(input_number - 1) + generate_fibonacci(input_number - 2);
END IF;
END;