Quick Search:
 
 The Oracle XMLSEQUENCE Function      [Return To Index] Jump to:  

Term: XMLSEQUENCE

Definition:
In Oracle PL/SQL, the built-in XMLSEQUENCE function takes XML type instances as input and returns its equivalent XMLSequenceType value. XMLSequenceType value is nothing but a collection of XMLType instances.

Example Syntax:

XMLSEQUENCE ([XMLType instance | SYS_REFCURSOR instance])


In the syntax, note that it can accept either an XML Type instance or a ref cursor instance.

Example Usage

Case 1: The SQL below uses fixed values (type casted as XML type instance) as input to the XMLSEQUENCE function.

SELECT value(T).getstringval() Attribute_Value
FROM table(
XMLSequence(
EXTRACT(
XMLType('<Node><ValueNode>Oracle</ValueNode>
<ValueNode>SQL</ValueNode>
<ValueNode>PLSQL</ValueNode></Node>'),
'/Node/ValueNode'
)
)
) T


ATTRIBUTE_VALUE
-------------------------------------------
<ValueNode>Oracle</ValueNode>
<ValueNode>SQL</ValueNode>
<ValueNode>PLSQL</ValueNode>



Case 2: The SQL below uses a cursor sub query as input to XMLSequence function.

SELECT VALUE(em).getCLOBVal() 
AS "XMLTYPE"
FROM table(XMLSequence(Cursor(SELECT * FROM CUST_SALES
WHERE CUSTOMER_ID='Franklin'
AND MONTH='Jul'))) em
/

XMLTYPE
--------------------------------------
<ROW>
<CUSTOMER_ID>Franklin</CUSTOMER_ID>
<MONTH>Jul</MONTH>
<PRODUCT_ID>Prod Q5</PRODUCT_ID>
<SALES>Prod Q5</SALES>
<ROW>


Related Links:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org