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

Thread: SQL*Load - 0 into date field

  1. #1
    Join Date
    Dec 2001
    Location
    Keene, NH
    Posts
    510
    Hello,

    I am receiving flat delimitered files where the date is either YYYYMMDD or has just a zero (meaning no date).

    Is there a control file clause to convert 0 to null for that column? Otherwise I'll either write some shell script or even C code to transform the 0 data.

    Thank You!
    Don't blame me, I'm from Red Sox Nation.

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092

  3. #3
    Join Date
    Dec 2001
    Location
    Keene, NH
    Posts
    510
    This is what I have learned from the documentation (for anyone else who see's this subject and simply is curious themselves about how to do it).

    LOAD DATA
    .
    .
    .
    INTO TABLE t1
    fields terminated by "," optionally enclosed by '"'
    (
    col1,
    col2,
    col3 "DECODE( :col3,
    0,NULL,
    TO_DATE(:col3,'YYYYMMDD')
    )",
    col4,
    col5
    )

    Thank you again to all the paient people in this forum.
    Don't blame me, I'm from Red Sox Nation.

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