Sunday, June 26, 2011

PL/SQL Split function


SELECT substr(main_string, position_from + 1, position_to - position_from - 1)
FROM (SELECT main_string,
decode(rownum - 1, 0, 0, instr(main_string, ',', 1, rownum - 1)) position_from,
instr(main_string, ',', 1, rownum) position_to
FROM (SELECT '111,123,aaabbb,555,' main_string
FROM dual)
CONNECT BY LEVEL <= length(main_string))
WHERE position_to > 0;
Reply With Quote

No comments:

Post a Comment