select *
from tbl1
where tbl1.bill_date=TO_DATE('1/
Main Topics
Browse All TopicsHello,
I have the following sql command in Oracle8 DB and got "not a valid month" error.
select *
from tbl1
where tbl1.bill_date='1/1/2006' ;
Any help will be appreciated.
-M
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I tried the following:
select count(*)
from tbl1
where to_char(bill_date,'mm/dd/y
It returns me 0.
if I try
select count(*)
from tbl1
where to_char(bill_date,'mm/dd/y
It returns me 450.
Is there a way to fix the problem so it always return me the correct number?
Thanks.
When you do
select count(*)
from tbl1
where to_char(bill_date,'mm/dd/y
then you are comparing string values. So in this case the to_char function creates the string like '06/30/2006' and compares it to '6/30/2006'. That's why your result is 0, so the problem is not necessarily due to a time portion.
Both Johnsone's and Nav_kum_v's solution will work, but when you have an index on bill_date, Johnsone's solution will be faster.
Business Accounts
Answer for Membership
by: mrongPosted on 2006-10-30 at 06:50:07ID: 17833952
bill_date is in '30-JUN-06' format.