Oracle9i SQL Reference
Release 1 (9.0.1)

Part Number A90125-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Functions, 125 of 166


SYS_XMLGEN

Syntax

sys_xmlgen::=


Text description of functions136a.gif follows
Text description of sys_xmlgen

Purpose

The SYS_XMLGEN function takes an expression that evaluates to a particular row and column of the database, and returns an instance of type SYS.XMLType containing an XML document. The expr can be a scalar value, a user-defined type, or an XMLType instance.

By default the elements of the XML document match the elements of expr. For example, if expr resolves to a column name, the enclosing XML element will be the same column name. If you want to format the XML document differently, specify fmt, which is an instance of the SYS.XMLGenFormatType object.

See Also:

 

Example

The following example retrieves the employee email ID from the sample table oe.employees where the employee_id value is 205, and generates an instance of an XMLType containing an XML document with an EMAIL element.

SELECT SYS_XMLGEN(email).getStringVal()      
   FROM employees
   WHERE employee_id = 205;

SYS_XMLGEN(EMAIL).GETSTRINGVAL()
------------------------------------------------------------------
<EMAIL>SHIGGENS</EMAIL>


Note:

XMLType data is treated the same as CLOB data, which cannot be displayed using SQL*Plus. Therefore, this example appends the XMLType.getClobVal method to the function in order to view the actual document. This method is not necessary, for example, if you are inserting an XMLType value into a database. 



Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback