DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: SQL - Number To Date

  1. #1
    Join Date
    May 2008
    Posts
    3

    Thumbs up SQL - Number To Date

    Hi,

    My database is Oracle 10g. DATE is stored NUMBER datatype on a table and I need to access this number and display it in Date format using SQL.

    Pls Can anyone help?

    Ex:

    > SELECT SLIVD FROM ;

    SLIVD
    ----------
    108090

    Regards,
    Pandian
  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    What is the date format? 10 could be month, year or date, but 80 and 90 would only work in the year portion. i.e. 1980/1990. If you are dealing with a number, and it is properly formatted using the to_date('20080507', 'YYYYMMDD') will work. You just need to know that format that the numbers are in otherwise...


    Code:
    SQL> SELECT TO_DATE('108090', 'MMDDYY') from dual;
    SELECT TO_DATE('108090', 'MMDDYY') from dual
                   *
    ERROR at line 1:
    ORA-01847: day of month must be between 1 and last day of month

  3. #3
    Join Date
    May 2008
    Posts
    3

    Thumbs up Sql

    Hi

    The field SLIVD (Invoice date) is given date format (Ex: 24/12/2007).
    But, the date is stored in database is ‘107358’ (SLIVD - NUMBER - data type).

    How to select date format from data base?

    Ex:

    >SELECT SLIVD FROM F42199 WHERE SLDOCO=206 ANS SLMCU=11090

    >107289

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    I have no idea what "SLIVD - NUMBER - data type" is. I'm guessing it isn't an Oracle support way of storing dates. So if you want help writing a function to do the conversion, then you need to explain the format. How does someone convert from SLIVD to a gregorian date?

  5. Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  


    Click Here to Expand Forum to Full Width