Pergunta

I have a column which contains a String with numbers like '12345' (no separator or blanks) and I want to split this column to rows for each character:

From:

 COLUMN
 ------------------
 12345

To:

 COLUMN
 ------------------
 1
 2
 3
 4
 5

This Should work in a single select so that I can use it like this:

... AND WHERE SOMECOLUMN NOT LIKE (... THE SELECT ...)

Foi útil?

Solução

with temp as (select '12456' as str from dual)
select substr(str,level,1)
from temp
connect by level <= length(str);

Result:

1
2
4
5
6
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top