File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes How to get an XMLElement in resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to get an XMLElement in resultset" Watch "How to get an XMLElement in resultset" New topic
Author

How to get an XMLElement in resultset

varsha rao
Greenhorn

Joined: Mar 06, 2006
Posts: 26
Hi ,

I have the following query

SELECT z.itr_sys_id,
(SELECT XMLElement("AMOUNT",XMLAgg(XMLElement("wmm_match_am", wmm_match_am)))
FROM wire_mti_match x
WHERE x.itr_sys_id = z.itr_sys_id
) AS Amount
FROM icms_transaction z


The result returned is as follows
--------------------------------------------------------------
156565 <AMOUNT><wmm_match_am>500</wmm_match_am><wmm_match_am>500</wmm_match_am><wmm_match_am>0</wmm_match_am></AMOUNT>


But when i do resultset.getString("Amount") , i get null
I am not able to read the result into an appropriate java object.

Could anyone help me with this please?

Thanks
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

Try creating an alias for that XML column:

Then calling:


SCJP 6 || SCWCD 5
varsha rao
Greenhorn

Joined: Mar 06, 2006
Posts: 26
Hey,

I have precisely done the same thing which you said. I also did some more research on this.

http://www.dbvis.com/forum/message.jspa?messageID=7512

You need to convert it to XMLType.

Unforunately this didnt work on Oracle10g .


Has someone tried the same on 10g?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get an XMLElement in resultset