For the record, there is no difference between the two statements.
Code:
SQL> SELECT TO_CHAR(sysdate-1440/1440,'DD-MON-YY HH:MI:SS pm') FROM DUAL;
TO_CHAR(SYSDATE-1440/
---------------------
19-JUN-03 03:45:54 pm
SQL> SELECT TO_CHAR(sysdate-1,'DD-MON-YY HH:MI:SS pm') FROM DUAL;
TO_CHAR(SYSDATE-1,'DD
---------------------
19-JUN-03 03:45:54 pm
So where TO_char(date_field) > SYSDATE - 1; is the same as
where TO_char(date_field) > SYSDATE - 1440/1440;
Originally posted by gandolf989 SELECT TO_char(date_field) FROM TEST_TABLE Where
TO_char(date_field) > SYSDATE - 1;
Look, left and right expression in where predicate are of different datatypes here.
I wonder what will happen? If right expression implicitly converts to char, then this is wrong.
Bottom line: get rid of this to_char in where clause.
Tomaž "A common mistake that people make when trying to design something completely
foolproof is to underestimate the ingenuity of complete fools" - Douglas Adams
Bookmarks