I have a string/column something like this
String a = \"000003023_AggregateStopLossLimit_W x3A 973911_2012-12-22.PDF\";
I want to create a subs
If you need a SQL solution, this will update the rows:
update yourtable
set field = substr(field, 0, instr(field, ' ')-1) || substr(field, instr(field, '_', instr(field, ' ')))
;
and this will just show the converted value:
select
yourtable.field,
case
when instr(field, '_', instr(field, ' '))>instr(field, ' ')
then substr(field, 0, instr(field, ' ')-1) || substr(field, instr(field, '_', instr(field, ' ')))
else field
end as new_field
from
yourtable