What should be the XML format for this code. [message #602619] |
Fri, 06 December 2013 00:51 |
|
ramya_162
Messages: 107 Registered: August 2013 Location: Banglore
|
Senior Member |
|
|
Hi Experts,
For the below code what should be the XML format.
select cast(extractValue(value(i), '*/@v') as varchar2 (25 char)) as V_VALUE
, cast(extractValue(value(i), '*/@s') as varchar2 ( 5 char)) as SID
, cast(extractValue(value(i), '*/@m') as number ) as MTIME
from table(XmlSequence(extract(XmlType(p_xml_text), '/l/i'))) i
I have tried this but not working.
'<l>
<i>
<v="C4567892" s="333" m="50" />
<v="C3245986" s="5556" m="50" />
</i>
</l>'
Please provide the correct XML message format for the above code.
Thanks.
|
|
|
Re: What should be the XML format for this code. [message #602624 is a reply to message #602619] |
Fri, 06 December 2013 01:21 |
_jum
Messages: 577 Registered: February 2008
|
Senior Member |
|
|
The text is no valid XML. Start with:
WITH xml_text AS
(SELECT
'<l>
<i>
<row v="C4567892" s="333" m="50"/>
<row v="C3245986" s="5556" m="50"/>
</i>
</l>' p_xml_text FROM dual)
SELECT
EXTRACTVALUE(VALUE(i), '*/@v') V_VALUE,
EXTRACTVALUE(VALUE(i), '*/@s') SID,
EXTRACTVALUE(VALUE(i), '*/@m') MTIME
FROM xml_text,
TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE(p_xml_text), '/l/i/*'))) i;
V_VALUE SID MTIME
--------------------------------------------------------------------------------
C4567892 333 50
C3245986 5556 50
Btw. you could/should use XMLTABLE instead.
[Updated on: Fri, 06 December 2013 01:25] Report message to a moderator
|
|
|
|
|
|
|
|
|