如何使用JDBC ResultSet从XMLType Query获取数据?

时间:2016-10-06 09:02:56

标签: xml oracle jdbc resultset xmltype

我有一个XMLType查询,如下所示:

SELECT
   c.CustId,
   XMLELEMENT(NAME "customer",
      XMLATTRIBUTES(c.CustId AS "id"),
      XMLELEMENT(NAME "name",c.Name),
      XMLELEMENT(NAME "city",c.City),
      XMLELEMENT(NAME "projects",
      (SELECT XMLAGG(XMLELEMENT(NAME "project",
                 XMLATTRIBUTES(p.ProjId AS "id"),
                 XMLELEMENT(NAME "name",p.Name)))
      FROM Projects p 
      WHERE p.CustId=c.CustId))) AS "customer-projects"
FROM Customers c

我想使用JDBC ResultSet获取数据。 我试过了

ResultSet result.getString("customer-projects");

但是这给了我无效。

请帮忙。

0 个答案:

没有答案