Home » Developer & Programmer » Forms » Getting date
Getting date [message #588927] Sat, 29 June 2013 18:55 Go to next message
jocelyne
Messages: 34
Registered: December 2012
Location: lebanon
Member
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: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is the type of "dateexpr"?

Quote:
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.)

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


Current Time: Fri Apr 19 16:01:03 CDT 2024