Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL XML Question
Steve,
Do you think it matters that your insert statement looks incorrect? You have:
I could be wrong - but it looks unbalanced.
<price type="US">10.00</price>
Tom
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Booth.Steve
Sent: Friday, September 22, 2006 2:38 PM
To: Oracle-L_at_FreeLists.org
Subject: SQL XML Question
I've been having problems dealing with retrieving data and appropriate records based upon XPATH searching criteria in my PL/SQL. I'm running 9iR2. Here's the Table creation and sample XML Records:
CREATE TABLE T_XML_BOOKS
(
ID_NBR NUMBER, DATE_XML NUMBER, TIME_XML NUMBER,
SELECT ID_Nbr, Date_XML, Time_XML,
extract(XML_DATA,'/').getStringVal() as XML_Data
FROM T_XML_BOOKS; Second (Which Works -- demonstrates use of extractValue): SELECT extractValue(xml_data, '/bookcatalog/book/title') as Title_Val
FROM t_XML_BOOKS;
Third (doesn't return author, firstname or ISBN)?
SELECT extractValue(xml_data, '/bookcatalog/book/title') as Title_Val,
extractValue(xml_data, '/bookcatalog/book/title/author') as auth,
extractValue(xml_data, '/bookcatalog/book/title/firstname') as fname,
extractValue(xml_data, '/bookcatalog/book/title/ISBN') as
ISBN_Val
FROM t_XML_BOOKS
Fourth (Returns incorrect value from the existsNode function)?
SELECT extractValue(xml_data, '/bookcatalog/book/title') as Title_Val,
existsNode(xml_data, '/bookcatalog/book/title[QUERY="History of
Interviews"]') as Response
FROM t_XML_BOOKS;
I would have expected "Response" to be a "1" on the one record and "0"
on the
other.
What am I missing?
TIA Steve...
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Sep 22 2006 - 14:14:25 CDT
![]() |
![]() |