Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Return Oracle Datetime as 'Excel' Number??

763900Sep 6 2010 — edited Sep 7 2010
Hello All,

I am working with an Excel sheet that is referencing a dataset returned from an Oracle 10g database.

I am having some serious issues with one of the columns which uses a timestamp in Oracle, which is messing up my date functions.

What I really want is for Oracle to return the date as a number from the datetime. I do not care about the time I'm happy to get rid of it.

I can't figure this out for the life of me though could anybody please help me?

I want the date as a number that Excel will understand. For example today is 06/09/2010 (UK date format, DDMMYYYY), which Excel translates as 40427.

Therefore I need my Oracle query to return the number 40427.

I tried using TRUNC(SYSDATE), but that seems to be bringing the date back as a string.

SELECT TO_NUMBER(TO_CHAR(SYSDATE)) FROM DUAL is bringing back an 'invalid number' error.

Would anybody happen to have any suggestions??

Thank you! :)

Jon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2010
Added on Sep 6 2010
22 comments
10,274 views