add

About Me

My photo
Oracle Apps - Techno Functional consultant

Wednesday, September 28

Splitting String using Oracle SQL

SELECT TRIM( SUBSTR ( txt
, INSTR (txt, ',', 1, level ) + 1
, INSTR (txt, ',', 1, level+1) - INSTR (txt, ',', 1, level) -1
)
)
AS token
FROM ( SELECT ','||:in_string||',' AS txt FROM dual )
CONNECT BY level <= LENGTH(txt)-LENGTH(REPLACE(txt,',',''))-1

No comments: