1. This will insert the records into db table by reading from ta csv file

I have this code with me but the condition is If any of the mandatory columns are null then entire file will be rejected.

LOAD DATA
  infile   '  '     #specifies the name of a datafile containing data that you want to load
  BADFILE ' '                              #specifies the name of a file into which rejected records are placed
  BADFILE ' '                              #specifies the name of a file into which discarded records are placed
  APPEND      #to insert data in a nonempty table
  INSERT      #to enter the data into an empty table
  INTO TABLE ts_item_loc_stage_data
  FIELDS TERMINATED BY "|" optionally enclosed by '"'
  TRAILING NULLCOLS 
  (
   Seq_no                    NUMBER(10 ),
   Item                      CHAR(25),
   Loc         			     NUMBER(10),
   Mail_id   		         CHAR(100),
   Status    		         CHAR(1),
   Error_message			 CHAR(255),
   Mail_ind			         CHAR(1)
  );

--- Post updated at 08:01 AM ---

can anyone help me with the query

Hello raka123,

I have a few to questions pose in response first:-

  • What variations have you tried so far and what output do you get?
  • What database and version are you trying to load into? Oracle, Informix, DB2, MySQL/MariaDB?
  • What OS and version are you using?
  • Have you read the syntax pages for your database?

There may be an IGNORE, REPLACE or REPORT type option, but these depend on the database you are trying to load to.

We're all here to learn and getting the relevant information will help us all.

Kind regards,
Robin