日期:2014-05-19  浏览次数:20378 次

怎么生成一个树型结构的XML文件?
UserID             ChildID             ParentID
1                         1                         null
2                         2                         1
3                         3                         1
4                         4                         2
5                         5                         2


数据库的结构是这样的,我现在怎样才能写成一个树型结构的XML文件啊?

------解决方案--------------------
select sys_connect_by_path(parentID, '/ ') || '/ ' || childID
from userTable
start with parentID is null
connect by parentID = prior childID
------解决方案--------------------
then generate the xml file by the selected result
------解决方案--------------------
代碼范例可以參照:http://www.codeproject.com/aspnet/SquaredRomiss.asp