Please help with Conversion function in sql

Hello everyone

I need to convert date with format mm/dd/yyyy to numeric nnnn format

char to varchar

in oracle sql query

Please help


arukuAsked:
Who is Participating?
 
HainKurtSr. System AnalystCommented:
sorry, you should use

select to_number(to_char(dob, 'fmYYYY')) from dual --> will give you number 2003
select to_char(dob, 'fmYYYY') from dual --> will give you char '2003'
0
 
HainKurtSr. System AnalystCommented:
select to_char(sysdate, 'fmYYYY') from dual

date does not have format, I mean datetime column in database...

can you please give example showing what are you tryin to do...
0
 
felipevidaurriCommented:
You need convert Date to Numeric Format like Excel used?...
0
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
arukuAuthor Commented:
For example 12/23/2008 must be  as 2008

i need to convert the date fromat to numeric and use right function


i need to convert a char value to varchar
0
 
arukuAuthor Commented:
In the database the dob is for example given as 12/23/2003 then after writing the query i need to get only
2003. The dob in date datatype and i need to convert it to numeric. I need to write in oracle
0
 
HainKurtSr. System AnalystCommented:
select to_number(to_char(sysdate, 'fmYYYY')) from dual
0
 
arukuAuthor Commented:
Can you please tell me the same way how to convert Char datatype to Varchar2 and numeric to Varchar2
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.