Convert each character in a string to a row

三世轮回 提交于 2019-12-12 01:38:08

问题


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 ...)


回答1:


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


来源:https://stackoverflow.com/questions/23608134/convert-each-character-in-a-string-to-a-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!