drop table t; CREATE TABLE T AS SELECT * FROM DBA_OBJECTS; CREATE OR REPLACE FUNCTION F_NO_RESULT_CACHE RETURN NUMBER AS V_RETURN NUMBER; BEGIN SELECT COUNT(*) INTO V_RETURN FROM T; RETURN V_RETURN; END; / set autotrace on statistics SELECT F_NO_RESULT_CACHE FROM DUAL; --看调用F_NO_RESULT_CACHE执行第2次后的结果 SELECT F_NO_RESULT_CACHE FROM DUAL; CREATE OR REPLACE FUNCTION F_RESULT_CACHE RETURN NUMBER RESULT_CACHE AS V_RETURN NUMBER; BEGIN SELECT COUNT(*) INTO V_RETURN FROM T; RETURN V_RETURN; END; / SELECT F_RESULT_CACHE FROM DUAL; --看调用F_RESULT_CACHE执行第2次后的结果 SELECT F_RESULT_CACHE FROM DUAL;
函数的逻辑读成零
时间: 2024-10-12 12:04:13