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

Thread: loading default value via sql loader

Hybrid View

  1. #1
    Join Date
    Apr 2004
    Location
    ny,ny
    Posts
    24

    loading default value via sql loader

    1) my flat file is like such.

    id t2_id t_date
    1902004-09-13
    2952004-09-15

    2) table

    my_tab
    ---------------
    id numbber
    t2_id number
    t_date date
    created_by number
    created_date date

    3) i would like to load flat file
    while defaulting create_by to 1
    and created_date to to_date(20040914,'yyyymmdd')



    4) i would like to do something like this(whic doesn't work):

    load data
    infile '/tmp/flat_file.txt"str X'02'"
    append
    into table my_tab
    fields TERMINATED BY X'01'
    trailing nullcols(
    id,
    t2_id,
    t_date,
    created_by default 1,
    created_date default to_date(20040914,'yyyymmdd'))

    thanks

  2. #2
    Join Date
    Apr 2004
    Location
    ny,ny
    Posts
    24
    never mind. something like this works. the constant keyword filled in the defaults.

    infile '/u02/data/emusic/EMUSIC.song_dl_history.00.txt' "str X'02'"
    truncate
    into table songs
    fields TERMINATED BY X'01'
    trailing nullcols(
    USER_ID,
    SONG_ID,
    DATE_DOWNLOADED date "yyyy-mm-dd" nullif date_downloaded="0000-00-00",
    RIGHT_ID filler,
    album_id filler,
    created_by constant 1,
    created_date sysdate,
    updated_by constant 1,
    updated_date sysdate)

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