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






Create xml element with xmlelement function

 

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>

   
  








Related examples in the same category

1.XMLElement: output result in XML