AllExperts > Oracle 
Search      
Oracle
Volunteer
Answers to thousands of questions
 Home · More Oracle Questions · Answer Library  · Encyclopedia ·
More Oracle Answers
Question Library

Ask a question about Oracle
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Suchitra Joshi
Expertise
I can answer questions regarding SQL, PL/SQL, Procedures, Functions, Triggers, SQL Loader, Oracle Forms, Oracle Reports, and some basic dba and performance tuning activities.

Experience
15+ years of Oracle PL/SQL Development

Education/Credentials
B.Sc (Electronics), Diploma in Computer Applications (DCA)

Awards and Honors
OCP - SQL and PL/SQL
Brainbench certifications in Oracle Administration, PL/SQL, Developer 2000

 
   

You are here:  Experts > Computing/Technology > Oracle > Oracle > Invalid Number while using to_char date and group by of same column

Oracle - Invalid Number while using to_char date and group by of same column


Expert: Suchitra Joshi - 6/6/2009

Question
Hi Suchitra, I have been reading your answers. All you guys are doing a great service. Thanks a lot.

I am running the following query,

select count(*),
to_char('SOME_DATE,'dd-mon-yyyy')
from SOME_TABLE
group by
to_char('SOME_DATE','dd-mon-yyyy')

I get this error message INVALID NUMBER ORA-01722.

I am stuck with this, Please help me to get over this.
The data type for the date column in DATE.

Even if i try a simple

select to_char('SOME_DATE','dd-mon-yyyy') from SOME_TABLE,
I get the same error message. Please advice.


Answer
Hi Raghavendran,

If the SOME_DATE column is a date column, then it should not be given in single quotes (since you are using to_char function).

So try removing the single quotes around SOME_DATE column.

Hope this helps.

Regards

Suchitra

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.