Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI,
I was trying to run the following query in oracle but it isn't working,
can anybody tell me what is the error in this query apart from paranthesis.


sql>SELECT TO_CHAR(promo_begin_date,dd/month&)
FROM promotions
WHERE promo_begin_date IN (TO_DATE(JUN 01 98;,TO_DATE(JUL 01 98));


Thanks.
Posted
Updated 2-Oct-14 22:18pm
v2
Comments
Kschuler 2-Oct-14 16:27pm    
What error message are you getting?
CPallini 3-Oct-14 4:40am    
An error message would help.

1 solution

There are several small problems.
Firstly, the To_Char function wants the format_mask as a string, and I wonder if you really want the ampersand to be a part of the date.
Secondly, you have a semicolon in the middle of the second row that terminates the query. I also recommend to always use a format_mask here to, to avoid misunderstandings.
So try:
SQL
SELECT  TO_CHAR(promo_begin_date,'dd/month')
FROM    promotions
WHERE   promo_begin_date IN (TO_DATE(JUN 01 98,'MON DD YY'),TO_DATE(JUL 01 98,'MON DD YY'));

More info on format_masks here[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900