I'm trying to use SQL Loader and while inserting the data into the tables I need to check some conditions and insert the data.
Example:
CASE COLUMNA
WHEN 'NULL'
-- INSERT NULL VALUE IN IT INSTEAD OF STRING 'NULL'
ELSE
-- INSERT THE DATA AS IS
END
Can we use these case statements in the SQL Loader control file? Couldn't find good examples for this any where.
Try adding the codition in your control file like:
load data
APPEND INTO TABLE XXX
fields terminated by "\t"
TRAILING NULLCOLS
( --Condition which you can add.
START_DATE "CASE WHEN length(:START_DATE ) < 10 THEN null ELSE :START_DATE END"
)
where START_DATE
isthe column of the table