Home » SQL & PL/SQL » SQL & PL/SQL » comparison of to_char function (10.2.0.2)
comparison of to_char function [message #379742] Wed, 07 January 2009 17:50 Go to next message
varunvir
Messages: 363
Registered: November 2007
Senior Member
Hi Experts,
I am giving following query:-
select * from bhi_tracking where TO_CHAR(TIME_STAMP, 'MM/DD/YYYY')>'01/01/2008'

But I am getting results before the given date too.
Please rectify my mistake.
Regards,
Varun Punj,
Re: comparison of to_char function [message #379744 is a reply to message #379742] Wed, 07 January 2009 17:53 Go to previous message
BlackSwan
Messages: 25571
Registered: January 2009
Location: SoCal
Senior Member
>Please rectify my mistake.
You are comparing strings instead of DATE datatypes.
If you insist on strings then they must be formated in collating sequence.

The reality is that '02' is greater than '01';
regardless of the characters to the right of the 1 or 2 characters above.

[Updated on: Wed, 07 January 2009 19:24]

Report message to a moderator

Previous Topic: Trigger (merged)
Next Topic: Number format
Goto Forum:
  


Current Time: Sat Aug 19 08:18:51 CDT 2017

Total time taken to generate the page: 0.05331 seconds