1 2 3 4 5 6 7 8 9 10 11 12 13
| WITH sr AS
(
SELECT ' PREMIERE PARTIE ZZ SECONDE PARTIE' AS col FROM dual union ALL
SELECT ' ZZ PREMIERE PARTIE ZZ SECONDE PARTIE' FROM dual
)
SELECT col ,REPLACE (col,'ZZ', ' '), instr(col,' ZZ',1,1),instr(col,' ZZ',1,2),instr(col,' ZZ',1,2)-(instr(col,' ZZ',1,1)+4),
substr(col,instr(col,' ZZ',1,1)+4,--length(col))
case when (instr(col,' ZZ',1,2)-(instr(col,' ZZ',1,1)+4))> 0
then instr(col,' ZZ',1,2)-(instr(col,' ZZ',1,1)+4)
when (instr(col,' ZZ',1,2)-(instr(col,' ZZ',1,1)+4))< 0 then
length(col)
end )
FROM sr |
Partager