2010/09/13

DATE

DATE '2001-01-01' 

2010/09/01

Split String by Space

WITH RECURSIVE temp_table (col, layer) AS
(
sel addr_chmi_nm  as col, 1 as layer from batm_jyusho where  index(addr_chmi_nm,' ') = 0
union all
sel substr(addr_chmi_nm, index(addr_chmi_nm,' ')+1) as col, 0 as layer from batm_jyusho
union all
sel trim(substr(addr_chmi_nm, 1, index(addr_chmi_nm,' '))) as col, 1 as layer from batm_jyusho  where  index(addr_chmi_nm,' ') <> 0
union all
sel substr(col, index(col,' ')+1) as col , 0 as layer from temp_table  where layer = 0 and index(col,' ') <> 0
union all
sel trim(substr(col, 1, index(col,' '))) as col , 1 as layer from temp_table  where layer = 0   and index(col,' ') <> 0
)

sel * from temp_table where layer = 1