Sqlldr to accept 1 type of date format

前端 未结 2 966
温柔的废话
温柔的废话 2021-01-15 20:33

I have a sql script file that dynamically generates a control file. It accepts date fields in date formats for mm/dd/yyyy. The sqlldr is loading the dates from the csv fi

2条回答
  •  失恋的感觉
    2021-01-15 21:05

    I found the answer. Date formatting in oracle allows options FX and FM for exact formatting

    for example

    select to_date('6/21/2016', 'FXfmMM/FXdd/FXYYYY') from dual;
    

    returns 6/21/2016

    select to_date('6-21-2016', 'FXfmMM/FXdd/FXYYYY') from dual;
    

    will return error "literal does not match format string"

    so in my control file sql script i added the FX and FM commands

    '  col7 DATE "FXFMMM/FXDD/FXYYYY",' || chr (10) ||
    '  col8 DATE "FXFMMM/FXDD/FXYYYY",' || chr (10) ||
    

    now only dates with exactly mm/dd/yyyy format will be accepted and the rest will be rejected as a bad row

提交回复
热议问题