Wednesday, February 8, 2017


XMLTYPE in Oracle

CREATE TABLE warehouses(
  warehouse_id NUMBER(4),
  warehouse_spec XMLTYPE,
  warehouse_name VARCHAR2(35),
  location_id NUMBER(4));


INSERT INTO warehouses VALUES 
   (       100, XMLType(
              ' 
               Owned
               '), 'Tower Records', 1003);




SELECT 
  w.warehouse_spec.extract('/Warehouse/Building/text()').getStringVal()
     "Building"
  FROM warehouses w;

where warehouse_spec is an XMLType column operated on by member function extract(). The result of this simple query is a string (varchar2):

Building
-----------------
Owned



UPDATE warehouses SET warehouse_spec = XMLType
                  ('
                    Leased
                    ');





for more details :Click Here

No comments:

Post a Comment