1
I need to make a replace
from the same column of several distinct strings, make a load data infile
.
Except that there is a syntax error on line 12 where the first case is, someone knows 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);