08:46:59 odssys@ORA9>select * from t;A - a b c d已用时间: 00: 00: 00.40 08:47:04 odssys@ORA9>select value from ( 08:47:14 2 select replace(sys_connect_by_path(a,' '),' ','') value,length(rep lace(sys_connect_by_path(a,' '),' ','')) len from 08:47:14 3 ( 08:47:14 4 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t 08:47:14 5 ) 08:47:14 6 start with rid2 is null 08:47:15 7 connect by prior rid1=rid2) 08:47:15 8 where len=(select max(len) from 08:47:15 9 (select length(replace(sys_connect_by_path(a,' '),' ','')) len fro m 08:47:15 10 ( 08:47:15 11 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t 08:47:15 12 ) 08:47:15 13 start with rid2 is null 08:47:15 14 connect by prior rid1=rid2) 08:47:15 15 );VALUE --------------------------------------------------------------------------------abcd已用时间: 00: 00: 00.40
08:48:51 odssys@ORA9>select * from t;A ---------- abd 2321 5da j8;已用时间: 00: 00: 00.40 08:49:03 odssys@ORA9>select value from ( 08:49:04 2 select replace(sys_connect_by_path(a,' '),' ','') value,length(rep lace(sys_connect_by_path(a,' '),' ','')) len from 08:49:04 3 ( 08:49:04 4 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t 08:49:04 5 ) 08:49:04 6 start with rid2 is null 08:49:04 7 connect by prior rid1=rid2) 08:49:04 8 where len=(select max(len) from 08:49:04 9 (select length(replace(sys_connect_by_path(a,' '),' ','')) len fro m 08:49:04 10 ( 08:49:04 11 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t 08:49:04 12 ) 08:49:04 13 start with rid2 is null 08:49:04 14 connect by prior rid1=rid2) 08:49:04 15 );VALUE --------------------------------------------------------------------------------abd23215daj8;已用时间: 00: 00: 00.40
SQL> select * from t;CODE ---- a b c dSQL> select replace(max(sys_connect_by_path(code,',')),',','') 2 from (select t.*,rownum rn from t) 3 start with rn =1 4 connect by rn = prior rn+1;REPLACE(MAX(SYS_CONNECT_BY_PAT -------------------------------------------------------------------------------- abcd
-
a
b
c
d已用时间: 00: 00: 00.40
08:47:04 odssys@ORA9>select value from (
08:47:14 2 select replace(sys_connect_by_path(a,' '),' ','') value,length(rep
lace(sys_connect_by_path(a,' '),' ','')) len from
08:47:14 3 (
08:47:14 4 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t
08:47:14 5 )
08:47:14 6 start with rid2 is null
08:47:15 7 connect by prior rid1=rid2)
08:47:15 8 where len=(select max(len) from
08:47:15 9 (select length(replace(sys_connect_by_path(a,' '),' ','')) len fro
m
08:47:15 10 (
08:47:15 11 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t
08:47:15 12 )
08:47:15 13 start with rid2 is null
08:47:15 14 connect by prior rid1=rid2)
08:47:15 15 );VALUE
--------------------------------------------------------------------------------abcd已用时间: 00: 00: 00.40
----------
abd
2321
5da
j8;已用时间: 00: 00: 00.40
08:49:03 odssys@ORA9>select value from (
08:49:04 2 select replace(sys_connect_by_path(a,' '),' ','') value,length(rep
lace(sys_connect_by_path(a,' '),' ','')) len from
08:49:04 3 (
08:49:04 4 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t
08:49:04 5 )
08:49:04 6 start with rid2 is null
08:49:04 7 connect by prior rid1=rid2)
08:49:04 8 where len=(select max(len) from
08:49:04 9 (select length(replace(sys_connect_by_path(a,' '),' ','')) len fro
m
08:49:04 10 (
08:49:04 11 select a,rownum+1 rid1,decode(rownum,1,null,rownum) rid2 from t
08:49:04 12 )
08:49:04 13 start with rid2 is null
08:49:04 14 connect by prior rid1=rid2)
08:49:04 15 );VALUE
--------------------------------------------------------------------------------abd23215daj8;已用时间: 00: 00: 00.40
----
a
b
c
dSQL> select replace(max(sys_connect_by_path(code,',')),',','')
2 from (select t.*,rownum rn from t)
3 start with rn =1
4 connect by rn = prior rn+1;REPLACE(MAX(SYS_CONNECT_BY_PAT
--------------------------------------------------------------------------------
abcd