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!

What's wrong of the date format?

fsze88hohoJul 4 2008 — edited Jul 4 2008
Dear Sir/Madam

I am coding an application by VB6 (XP Pro) with database oracle 11g (centOS 5).

As before, I was always using TO_DATE method to change a string to be date as following.

select sum(invoice_total) from invoice
where invoice_date between TO_DATE('01-07-2008','DD-MM-YYYY') and ADD_MONTHS(TO_DATE('01-07-2008','DD-MM-YYYY'), 1) -1

But, now I would like to simplify the query string to be following
select sum(invoice_total) from invoice
where invoice_date between '01/07/2008' and ADD_MONTHS('01/07/2008', 1) -1
But, it is don't work with an error 'ORA-01843:'
Is anyone can let me know what's the problem/error of above statement and how to solve it with simplified statement?

Thanks
Francis SZE
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 1 2008
Added on Jul 4 2008
11 comments
514 views