sql - Split a column on a comma -


i have oracle query returns result like

column1  column2  column3   1        -a,d    -def   2        -b,c    -jhi 

how can result like

column1 column2  column3  column4   1       -a       -d      -def 

utilize substring function receive part of string , instr function find position of comma.

select     column1,     substring(column2,1,instr(column2,',')-1) column2a,     substring(column2,instr(column2,',')+1) column2b,     column3 mytable 

example: http://sqlfiddle.com/#!2/ada12/12


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -