Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle XMLSEQUENCE Function      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

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      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 193 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?