Hello everyone,
the scenario goes like this:
1) I've created a table based on a .xsd schema. I plan on using it to store XMLtype objects.
create table xml_type_table OF XMLTYPE
XMLSCHEMA "http://my_schema.xsd" ELEMENT "Elem";
2) I get a CLOB value from an outside system. This CLOB is special in a way that it lacks one element called <vendor> that is registered in the schema I mentioned above.
3) I convert CLOB to an XMLType and I store it into the table xml_type_table .
l_xmltype:=XmlType.createXML(p_in_clob,'http://my_schema.xsd');
insert into xml_type_table values (l_xmltype);
4) The point of all this: I need to update that record with a vendor name, so I do a simple update statement. Commit. When I query the "vendor" tag from the table I get the value I updated the record with.
update xml_type_table p
set p.xmldata."vendor" = 'New_vendor'
where p.xmldata."ID"='10850';
select p.xmldata."vendor" -- returns the new updated vendor
from xml_type_table p
where p.xmldata."ID"='10850';
5) The problem: when I try to get the CLOB value of that XMLType I'm missing the <vendor> tag.
select value(p).getclobval()
from xml_type_table p
where p.xmldata."ID"='10850';
Why am I missing the <vendor> tag in my CLOB even though I've 'successfully' updated the XMLType?