I have the following data in a column named datos
. I want to update the text after the 8th slash (DR004), to be DR013.
/1/14/0/0/ / / /DR004/1/rttrgftgr/ZM003/0/0/0/1/0/
I have tried using this
update sumcon
set substr(datos, instr(datos, '/', 1, 8) + 1, 1) =
decode(substr(datos, instr(datos, '/', 1, 8) + 1, 1), ' ', 'DR013')
where nis_rad = 200000732;
but it's not working.
Here is a sample of the data from datos
column
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
/1/14/0/0/ / / /DR008/1/ /ZM004/0/0/0/0/0/
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
/1/14/0/0/ / / / /1/ / /0/1/0/0/0/
/1/14/0/0/ / / /DR008/1/ /ZM004/0/0/0/1/0/
/1/14/0/0/ / / / /1/ / /0/0/1/1/0/
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
/1/14/0/0/ / / /DR001/1/ /ZM004/0/0/0/0/0/
/1/14/0/0/ / / / /1/ / /0/0/0/1/0/
Per @LalitKumarB's suggestion, change your UPDATE statement to
UPDATE SUMCON
SET DATOS = SUBSTR(DATOS, 1, INSTR(DATOS, '/', 1, 8)) ||
'DR013' ||
SUBSTR(DATOS, INSTR(DATOS, '/', 1, 9))
WHERE NIS_RAD = 200000732;