Getting date [message #588927] |
Sat, 29 June 2013 18:55 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/526fb5d7092890677bd591daad81c1f1?s=64&d=mm&r=g) |
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 Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68666 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
|
|
|