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

Term: XMLCOLATTVAL

Definition:
In Oracle PL/SQL, the XMLCOLATTVAL function is used to generate an XML structure of the column values contained by a table.

The node follows the convention as <column name = [selected column]>.

Like many Oracle functions, you'll either never use this function or you'll use it all the time.

Example Syntax

XMLCOLATTVAL (value_expression AS <alias name> )


value_expression is the list of columns, which appearing in the XML structure

Example Usage

The SQL statement below shows the usage of XMLColAttVal function with EMP table, which select EMPNO and DEPTNO (as department) columns.

SELECT XMLElement("Emp",
XMLColAttVal(e.empno,e.deptno AS "department"))
AS "RESULT"
FROM EMP E
/

RESULT
-------------------------------------------------------------------
<Emp><column name = "EMPNO">7369</column><column name = "department">20</column>
<Emp><column name = "EMPNO">7499</column><column name = "department">30</column>
<Emp><column name = "EMPNO">7521</column><column name = "department">30</column>
<Emp><column name = "EMPNO">7566</column><column name = "department">20</column>
<Emp><column name = "EMPNO">7654</column><column name = "department">30</column>
<Emp><column name = "EMPNO">7698</column><column name = "department">30</column>
<Emp><column name = "EMPNO">7782</column><column name = "department">10</column>
<Emp><column name = "EMPNO">7788</column><column name = "department">20</column>
<Emp><column name = "EMPNO">7839</column><column name = "department">10</column>
<Emp><column name = "EMPNO">7844</column><column name = "department">30</column>
<Emp><column name = "EMPNO">7876</column><column name = "department">20</column>
<Emp><column name = "EMPNO">7900</column><column name = "department">30</column>
<Emp><column name = "EMPNO">7902</column><column name = "department">20</column>
<Emp><column name = "EMPNO">7934</column><column name = "department">10</column>

14 rows selected.


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