SELECT NVL(SUBSTR('J441:CHRONICOBSTRUCTIVEPULMONARYDISEASEW', 0, INSTR('J441:CHRONICOBSTRUCTIVEPULMONARYDISEASEW', ':')-1), 'J441:CHRONICOBSTRUCTIVEPULMONARYDISEASEW') AS output
FROM DUAL
возврат J441
with t1 as
(
select 'J441:CHRONICOBSTRUCTIVEPULMONARYDISEASEW' as col from dual
union all
select 'O80:ENCOUNTERFORFULL-TERMUNCOMPLICATEDDE' from dual
union all
select 'I7389:OTHERSPECIFIEDPERIPHERALVASCULARDI' from dual
) SELECT NVL(SUBSTR(col, 0, INSTR(col, ':')-1), col) AS output
FROM t1