Created
January 9, 2014 18:51
-
-
Save xtender/8339739 to your computer and use it in GitHub Desktop.
Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> create table tsysdate(dt date); | |
Table created. | |
SQL> create function fsysdate return date as begin return sysdate;end; | |
2 / | |
Function created. | |
SQL> explain plan for select * from tsysdate where fsysdate between dt and dt; | |
Explained. | |
SQL> @xplan | |
PLAN_TABLE_OUTPUT | |
------------------------------------------------------------------------------ | |
Plan hash value: 804111645 | |
------------------------------------------------------------------------------ | |
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | | |
------------------------------------------------------------------------------ | |
| 0 | SELECT STATEMENT | | 1 | 9 | 2 (0)| 00:00:01 | | |
|* 1 | TABLE ACCESS FULL| TSYSDATE | 1 | 9 | 2 (0)| 00:00:01 | | |
------------------------------------------------------------------------------ | |
Predicate Information (identified by operation id): | |
--------------------------------------------------- | |
1 - filter("DT"<="FSYSDATE"() AND "DT">="FSYSDATE"()) | |
-- as you can see, even if "DT" equal fsysdate when oracle compare first predicate, the function can return | |
-- another value within second predicate... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment