1

How can I use LOAD DATA INFILE syntax with the Number Of line will be inserted too into a table..?
I used this query:

LOAD DATA INFILE 'D:/home/TAM/input/Upload/DOC20120919000000.csv' INTO TABLE tb_t_doc_d FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES (rrn_no, new_color_cd, new_main_dealer_cd, new_zone_cd, new_branch_cd, new_destination_cd, @var) SET process_id = '1209219999999999', transaction_id = 'DC201209219999', reference = trim(TRAILING '\r' FROM @var), created_dt = sysdate(), created_by = "DIDIT", updated_dt = sysdate(), updated_by = "DIDIT", file_line_no = ???? ; 

What should I filled in on file_line_no = ????

1 Answer 1

3

This should help:

set @row = 0; LOAD DATA INFILE 'D:/home/TAM/input/Upload/DOC20120919000000.csv' INTO TABLE tb_t_doc_d FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES (rrn_no, new_color_cd, new_main_dealer_cd, new_zone_cd, new_branch_cd, new_destination_cd, @var) SET process_id = '1209219999999999', transaction_id = 'DC201209219999', reference = trim(TRAILING '\r' FROM @var), created_dt = sysdate(), created_by = "DIDIT", updated_dt = sysdate(), updated_by = "DIDIT", file_line_no = @row:=@row+1; 
Sign up to request clarification or add additional context in comments.

2 Comments

thanks, this is helpful! basically, SET @row = 0; LOAD DATA ... SET file_line_no = @row:=@row+1;
how can i show the value on file_line_no result of this?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.