Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

incorrect results with to_char function

user515689Dec 1 2016 — edited Dec 1 2016

Hi folks.

I run a jQuery calendar piece on my web form that retrieves results sets by use of the date field. It is optional, but many folks use it.

Today I noticed something very odd, and tested this in TOAD and Oracle SQL Developer, getting the same results.


I have table named FORM_TAB. In it, I can run the following:

select *

FROM FORM_TAB

WHERE to_char(TIME_REQ,'mm/dd/yyyy') > '12/01/2016'

I get dates from 2015, with all of December, only.

If I plug in for example, 11/17/2016 I will get results as expected, pulling back records from this day or greater.

My field, TIME_REQ, is a DATE field that I simply pass the SYSDATE value to on each insert.

Is this actually expected? To me it would not be.  I've only worked with Oracle about 8 years now, but thought I had a pretty good handle on this type of stuff.

Evidently not. LOL

Any feedback is appreciated.

This post has been answered by EdStevens on Dec 1 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2016
Added on Dec 1 2016
6 comments
644 views