Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2012
    Posts
    36

    Unanswered: varchar data conversion to date format

    Dear experts,

    My input column 'CREATE_DATE' is a varchar column with data in the format 'DD/MM/YY', I want my output in DATE Column with format 'YYYY-MM-DD'.

    Im trying with this code,

    select TO_DATE (TO_CHAR (TO_DATE (SAP_Licenses.LICENSE_EXPIRY_DATE, 'DD/MM/YY'),'DD-MM-YYYY'),'YYYY-MM-DD') dS from sap_licenses;

    It throws error like ORA-01830: date format picture ends before converting entire input string.

    Some one pls help.


    thank you in advance.

  2. #2
    Join Date
    Dec 2007
    Posts
    253
    TO_CHAR (TO_DATE (SAP_Licenses.LICENSE_EXPIRY_DATE, 'DD/MM/YY'),'YYYY-MM-DD')

    HOWEVER, you really, really, really, really should NOT be storing data that is supposed to be a date in a varchar column. It is an horrendous practice.

  3. #3
    Join Date
    Feb 2012
    Posts
    36
    Thank you very much friend.

    It is just a test environment, and hwever while on live we would not do this.

    that you agai.

  4. #4
    Join Date
    Dec 2007
    Posts
    253
    Sorry to be blunt, but being on a test environment is not, in itself an excuse. You should still be storing dates as dates.

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >It is just a test environment, and hwever while on live we would not do this.
    then your test system is useless since you are not TESTING what exists in Production!
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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