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: 25036
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: Table Design for summary data
Next Topic: need help data getting committed without commit statement in procedure
Goto Forum:
  


Current Time: Sun Dec 04 14:24:28 CST 2016

Total time taken to generate the page: 0.10917 seconds