Home » SQL & PL/SQL » SQL & PL/SQL » how to use TO_NUMBER function (Oracle, 10g, windows XP)
how to use TO_NUMBER function [message #351294] Tue, 30 September 2008 04:16 Go to next message
jyothsna1612
Messages: 68
Registered: June 2008
Member
Hi
How to convert Date value to number
Eg: sysdate ---->3092008

Could you please hint me the sample query on this....

Thank you
Re: how to use TO_NUMBER function [message #351295 is a reply to message #351294] Tue, 30 September 2008 04:19 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
TO_NUMBER(TO_CHAR(date,date_format_mask).number_format_mask)
Re: how to use TO_NUMBER function [message #351301 is a reply to message #351294] Tue, 30 September 2008 04:36 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
jyothsna1612 wrote on Tue, 30 September 2008 11:16
Hi
How to convert Date value to number
Eg: sysdate ---->3092008

Could you please hint me the sample query on this....

Thank you

What is 3092008? 03-09-2008 or 30-09-2008?
See the danger in changing the notation of date fields..
Re: how to use TO_NUMBER function [message #351305 is a reply to message #351295] Tue, 30 September 2008 04:44 Go to previous messageGo to next message
jyothsna1612
Messages: 68
Registered: June 2008
Member
hi bottom,
Thank you for the example
And i tried the following but getting error...

SQL> select to_number(TO_CHAR(sysdate, 'ddmmyyyy').'99999999') from dual;
select to_number(TO_CHAR(sysdate, 'ddmmyyyy').'99999999') from dual
                                              *
ERROR at line 1:
ORA-00919: invalid function


Re: how to use TO_NUMBER function [message #351306 is a reply to message #351305] Tue, 30 September 2008 04:46 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
How depressingly literal you are.
I made a typo in my post and put a period in when I meant to use a comma.
Do try to think for yourself, and possibly read the documentation
Previous Topic: :NEW in Trigger
Next Topic: convert a number to money format with $
Goto Forum:
  


Current Time: Thu Dec 08 18:11:52 CST 2016

Total time taken to generate the page: 0.08982 seconds