oracle11g - How to restrict loading data based on some criteria using sql loader in oracle? -
i have data file (.csv) contains 10lacs records. uploading file data table tbl_uploaded_data using oracle sql loader , control file concept.
i able upload data form file table smoothly without issues.
now requirement want upload relavant data based on criteria.
for example have table employee , columns empid,empname,remarks,empstatus
i have datafile employee data need upload employee table. here want restrict data should not upload employee table using sql loader. assume restriction criteria remarks should not contain 'no' , empstatus should not contain '00'.
how can implement this. please suggest changes done in control files.
you can use when
syntax choose include or exclude record based on logic, can use =
, !=
, <>
operators, won't quite need. if status field 2 characters can enforce part with:
... table employee when (empstatus != '00') fields ...
... , record 00
last field rejected, log showing like:
1 row not loaded because when clauses failed.
and use same method reject record remarks 'no'
- entire content of field:
when (remarks != 'no') , (empstatus != '00')
... not longer value contains no
. isn't entirely clear want.
but can't use like
or function instr
or regular expression more selective. if need more advanced you'll need load data staging table, or use an external table instead of sql*loader, , selectively insert real table based on conditions.
Comments
Post a Comment