Tuesday, November 16, 2010

Oracle 11g function result cache.

From: Quseful #10: Oracle11g function result cache (Steven Feuerstein)
Namely, whenever anyone in that database instance calls the function, Oracle first checks to see if anyone has already called the function with the same input values. If so, then the cached return value is returned without running the function body. If the inputs are not found, then the function is executed, the inputs and return data is stored in the cache, and then the data is sent back to the user. Oracle 11g function result cache.


PACKAGE BODY emplu IS
FUNCTION onerow(employee_id_in IN employees.employee_id%TYPE)
RETURN employees%ROWTYPE
RESULT CACHE RELIES_ON(employees)
IS
onerow_rec employees%ROWTYPE;
BEGIN
SELECT *
INTO onerow_rec
FROM employees
WHERE employee_id = employee_id_in;
RETURN onerow_rec;
END onerow;
END emplu;
/

From: Oracle® Database PL/SQL Language Reference 11g Release 2 (11.2)

function_heading


function_definition


relies_on_clause


Enabling Result-Caching for a Function

Developing Applications with Result-Cached Functions

Restrictions on Result-Cached Functions

Examples of Result-Cached Functions

Advanced Result-Cached Function Topics

No comments:

Post a Comment