1

Number Of line will will be inserted into a table.. で LOAD DATA INFILE 構文を使用するにはどうすればよいですか?
私はこのクエリを使用しました:

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 = ???? ;

何を記入すればいいですかfile_line_no = ????

4

1 に答える 1

3

これは役立つはずです:

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;
于 2012-09-24T09:07:36.130 に答える