标签:style blog color cti io div
函数的逻辑读成零
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;
标签:style blog color cti io div
原文地址:http://www.cnblogs.com/yg_zhang/p/3840531.html