Другой вариант - использовать SUBSTR
+ INSTR
(вместе с REPLACE
, конечно):
SQL> with test (col) as
2 (select 'STEP_D1_DEVTS_MN_PQ_LS' from dual)
3 select
4 replace(substr(col,
5 instr(col, '_', 1, 1) + 1, --> start after the 1st underscore
6 instr(col, '_', 1, 3) - instr(col, '_', 1, 1) - 1 --> take everything that's between 1st and 3rd underscore
7 ), '_', '-') result --> replace _ with -
8 from test;
RESULT
--------------------
D1-DEVTS
SQL>