oracle-databaseplsqlsql-loader

check NULL value and insert other column value in SQL*LOADER ORACLE


Below is the control file we used to load the data in table. The scenario is like, if COLUMN6 is NULL then use/insert COLUMN4 value while load the data into the table. Is it feasible through SQL*Loader. Have searched multiple place but not get the required details. Please assist me.

OPTIONS (ROWS=1000, READSIZE=2097152, BINDSIZE=2097152, PARALLEL=TRUE)
LOAD DATA
INFILE '{INFILE}'
APPEND

INTO TABLE TABLE_NAME
WHEN
FEED='FEED'
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(
COLUMN1  POSITION(1) DECIMAL EXTERNAL,
COLUMN2  CHAR(5),
COLUMN3  CHAR(11),
COLUMN4  CHAR(10),
COLUMN5  CHAR(30),
COLUMN6  CHAR(30)
)

Solution

  • Have you tried

    COLUMN6  CHAR(30) "NVL(:COLUMN6,:COLUMN4)"
    

    ?