|
|
发表于 2008/1/6 16:42:29
|
显示全部楼层
[php]
SQL> create table tb( a varchar2(4));
表已创建。
SQL> begin
2 insert into tb values('0001');
3 insert into tb values('0002');
4 insert into tb values('0003');
5 insert into tb values('0004');
6 end;
7 /
PL/SQL 过程已成功完成。
SQL> select * from tb;
A
----
0001
0002
0003
0004
SQL> Select replace(Substr(Sys_Connect_By_Path(a, ','), 2), ',', '')
2 From (Select Rownum Rid, Rownum + 1 Next_Rid, a From tb)
3 Where Rid = (Select Count(*) From tb)
4 Start With Rid = 1
5 Connect By Prior Next_Rid = Rid;
REPLACE(SUBSTR(SYS_CONNECT_BY_PATH(A,','),2),',','')
--------------------------------------------------------------------------------
0001000200030004
SQL>
[/php] |
|