Create xml element with xmlelement function : xmlelement « XML « Oracle PL/SQL Tutorial





SQL> CREATE TABLE products(
  2    product_id              NUMBER(6),
  3    name            VARCHAR2(50),
  4    category        VARCHAR2(50),
  5    price      NUMBER(8,2),
  6    min_price       NUMBER(8,2)
  7  );

Table created.

SQL>
SQL> select xmlelement( "Product",xmlattributes(p.product_id,p.name as "Name"),xmlforest(p.category as "Category",p.price as "price"))
  2  from products p;

no rows selected

SQL>
SQL> drop table products;

Table dropped.

SQL>
SQL>










33.3.xmlelement
33.3.1.Use XMLELEMENT to convert column data to xml format
33.3.2.XMLElement
33.3.3.Create xml element with xmlelement function