--------------------create temporary tables to temporarily save data parsed from an XML string---------------------------
Session-Level staging table
Sql> Create global temporary table Temp_order01 (OrderID number,ordernumber number,orderdate date) on commit Delete row S
Table created.
Transaction Level Temp Table
Sql> Create global temporary table Temp_order02 (OrderID number,ordernumber number,orderdate date) on commit preserve R oWS
Table created.
Sql> INSERT into Temp_order SELECT * from XMLTABLE (' $B/orderlist/order ' passing
XMLTYPE (' <?xml version= ' 1.0 ' encoding= ' gb2312 '? >&v_xml ') as B
COLUMNS OrderID number PATH '/order/orderid ',
OrderNumber number PATH '/order/ordernumber ',
OrderDate date PATH '/order/orderprice ');
Enter value for V_xml: <orderlist><order><orderid>1</orderid><ordernumber>01</ Ordernumber><orderdate>sysdate</orderdate></order></orderlist>
Old 2:xmltype (' <?xml version= ' 1.0 ' encoding= ' gb2312 '? >&v_xml ') as B
New 2:xmltype (' <?xml version= ' 1.0 ' encoding= ' gb2312 '? ><orderlist><order><orderid>1</ Orderid><ordernumber>01</ordernumber><orderdate>sysdate</orderdate></order> </orderlist> ') as B
1 row created.
Sql> select * from Temp_order;
ORDERID OrderNumber ORDERDATE
---------- ----------- ---------
1 1
Sql> commit;
Commit complete.
Sql> select * from Temp_order;
No rows selected
<orderlist><order><orderid>1</orderid><ordernumber>01</ordernumber>< Orderdate>sysdate</orderdate></order></orderlist>
Talk about temporal tables in Oracle