declare
  new_schema xmltype; 
  res boolean;
begin

   if (dbms_xdb.existsResource('/home/OE/purchaseOrder.v2.xsd')) then
      dbms_xdb.deleteResource('/home/OE/purchaseOrder.v2.xsd');
   end if;
 
   select appendChildXML (xdbUriType('/home/OE/purchaseOrder.xsd').getXML(),
                          '/xs:schema/xs:complexType[@name="LineItemType"]/xs:sequence',
                          xmltype('<xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Unit" type="xs:string" minOccurs="0" />'),
                          'xmlns:xs="http://www.w3.org/2001/XMLSchema"
                           xmlns:xdb="http://xmlns.oracle.com/xdb"')
          into new_schema from dual;

    res := dbms_xdb.createResource('/home/OE/purchaseOrder.v2.xsd',new_schema);
  
  commit;

end;
/
