Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Function Result Cache

I'm trying to use Oracle's Function Result Cache on 11.2.0, so I did the following test:

CREATE OR REPLACE FUNCTION get_test_value
  RETURN NUMBER
  RESULT_CACHE
AS
BEGIN
  dbms_output.put_line( 'Called' );
  RETURN 0;
END;

SELECT get_test_value FROM dual;

My example prints Called every time, though.
I also tried some other examples found online, but the cache is not used.

I tried ALTER SYSTEM SET result_cache_max_size = 10485760;
Still doesn't work.

I tried ALTER SESSION SET result_cache_mode=FORCE; (which should not be necessary) - didn't help.

SELECT dbms_result_cache.status FROM dual; always returns DISABLED.

What am I doing wrong?

like image 536
Peter Lang Avatar asked Feb 18 '10 17:02

Peter Lang


1 Answers

Which edition are you using? The Cache functionality is only available in Enterprise Edition, so if you're trying this on a Standard Edition install it wouldn't work. It's in the Licensing Guide.

like image 156
APC Avatar answered Nov 16 '22 23:11

APC