Home » Developer & Programmer » Forms » Getting date
Getting date [message #588927] Sat, 29 June 2013 18:55 Go to next message
Messages: 34
Registered: December 2012
Location: lebanon
i have this query :
select barcod
from product
where to_number(to_char(dateexpr,'YY'))=to_number(to_char(SYSDATE,'YY'))
AND to_number(to_char(dateexpr,'MM'))=to_number(to_char(SYSDATE,'MM')+2);

i'm sure the query is correct but how can i fix this error that i'm getting on the form:

error 307: too many declarations of "to_char" match this call

can you please help me asap ?
Re: Getting date [message #588931 is a reply to message #588927] Sun, 30 June 2013 01:04 Go to previous message
Michel Cadot
Messages: 65148
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is the type of "dateexpr"?

i'm sure the query is correct

I'm sure it is not.
If "dateexpr" is of DATE datatype, then your test is equivalent to:
trunc(dateexpr,'MONTH') = trunc(add_months(sysdate,2),'MONTH'))
(except it also works at the end of the year when yours not, check it when sysdate month is 11.)

Previous Topic: getting value from db
Next Topic: running .bat file
Goto Forum:

Current Time: Mon Aug 21 12:48:42 CDT 2017

Total time taken to generate the page: 0.08553 seconds