I need to make a replace
of the same column of several distinct string, make a load data infile
.
It just gives a syntax error on line 12 where it has the first case, does anyone know what I'm doing wrong the code is below?
LOAD DATA LOCAL INFILE 'c:/temp/reportes/fornecedor.csv'
INTO TABLE reparo.pn_digitron
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(@modelo,@tipo,
@part_number,@fornecedor,@descricao_bom)
SET
'Modelo' = trim(@modelo),
'tipo' = trim(@tipo),
case when 'part_number' = 'DT' then
'part_number' = trim(replace(@part_number, 'DT', 'MB')),
when 'part_number' = 'NB' then
'part_number' = trim(replace(@part_number, 'NB', 'MB')),
when 'part_number' = 'EBG' then
'part_number' = trim(replace(@part_number, 'EBG', 'MB')),
when 'part_number' = 'SMALL' then
'part_number' = trim(replace(@part_number, 'SMALL', 'SB')) end,
'fornecedor' = trim(@fornecedor),
'descricao_bom' = trim(@descricao_bom);