Oracle Parsing XML complete version

Source: Internet
Author: User

SELECT * from XMLTABLE (' $B/deal_basic/user_deal_info ' passing
XMLTYPE (' <?xml version= ' 1.0 ' encoding= ' gb2312 '? >&xml ') as B
COLUMNS user_deal_id VARCHAR2 () PATH
'/user_deal_info/user_deal_id ',
Deal_inure_time VARCHAR2 () PATH
'/user_deal_info/deal_inure_time ',
Deal_expire_time VARCHAR2 () PATH
'/user_deal_info/deal_expire_time ',
Deal_create_time VARCHAR2 () PATH
'/user_deal_info/deal_create_time ');



<DEAL_BASIC>
<USER_DEAL_INFO>
<USER_DEAL_ID>1000100001</USER_DEAL_ID>
<DEAL_INURE_TIME>20081130</DEAL_INURE_TIME>
<DEAL_EXPIRE_TIME>30000101</DEAL_EXPIRE_TIME>
<DEAL_CREATE_TIME>20081130</DEAL_CREATE_TIME>
</USER_DEAL_INFO>
</DEAL_BASIC>
--------------------------------------------------------
--The case one completed

SELECT * from XMLTABLE (' $B/row ' passing
XMLTYPE (' <?xml version= ' 1.0 ' encoding= ' gb2312 '? >&xml ') as B
COLUMNS
tp_id VARCHAR2 () PATH
'/row/tp_id ',
Tp_name VARCHAR2 () PATH
'/row/tp_name ',
Tp_parentid VARCHAR2 () PATH
'/row/tp_parentid ',
Tp_sname VARCHAR2 () PATH
'/row/tp_sname ');


<ROW>
<TP_ID>112</TP_ID>
<TP_NAME>oracle</TP_NAME>
<TP_PARENTID>0</TP_PARENTID>
<TP_SNAME>R</TP_SNAME>
</ROW>
----------------------------------------------------------------------
--Case Two single quotation marks are not recognized

SELECT * from XMLTABLE (' $B/deal_basic/user_deal_info ' passing
XMLTYPE (' <?xml version= ' 1.0 ' encoding= ' gb2312 '? >&xml ') as B
COLUMNS user_deal_id VARCHAR2 () PATH
'/user_deal_info/row_id ',
Deal_inure_time VARCHAR2 () PATH
'/user_deal_info/row_time ',
Deal_expire_time VARCHAR2 () PATH
'/user_deal_info/row_name ');



<DEAL_BASIC>

<USER_DEAL_INFO>
<ROW_ID>1000100001</ROW_ID>
<ROW_TIME>ORACLE</ROW_TIME>
<ROW_NAME>30000101</ROW_NAME>
</USER_DEAL_INFO>

<USER_DEAL_INFO>
<ROW_ID>1000100001</ROW_ID>
<ROW_TIME>ORACLE</ROW_TIME>
<ROW_NAME>30000101</ROW_NAME>
</USER_DEAL_INFO>

</DEAL_BASIC>
--------------------------------------------------------------------
--The case of the third completed
SELECT * from XMLTABLE (' $B/orderlist/order ' passing
XMLTYPE (' <?xml version= ' 1.0 ' encoding= ' gb2312 '? >&xml ') as B
COLUMNS OrderID VARCHAR2 () PATH
'/order/orderid ',
OrderNumber VARCHAR2 () PATH
'/order/ordernumber ',
Orderpricee VARCHAR2 () PATH
'/order/orderprice ');

<orderlist>
<order>
<orderid>1</orderid>
<ordernumber>857544544</ordernumber>
<orderprice>54</orderprice>
</order>

<order>
<orderid>2</orderid>
<ordernumber>858544544</ordernumber>
<orderprice>63</orderprice>
</order>

<order>
<orderid>3</orderid>
<ordernumber>454854555</ordernumber>
<orderprice>781</orderprice>
</order>
</orderlist>

It took a long, long, and finally a little connection.

Oracle Parsing XML complete version

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.