XMLTYPE with xml schema
SQL> create table myTable(
2 id number(9),
3 myValue xmltype
4 );
Table created.
SQL> begin
2 dbms_xmlschema.registerSchema ('http://d.com/myType.xsd',xdbURIType('/xsd/myType.xsd').getClob(),True,True,False,True);
3 end;
4 /
SQL>
SQL> insert into myTable values (67, XMLTYPE('<myType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://d.com/myType.xsd">
2 <value1>1</value1>
3 <value2>2</value2>
4 </myType>'))
5 /
1 row created.
SQL>
SQL> select * from myTable;
emp
Number
------
MYVALUE
------------------------------------------------------
67
<myType xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
stance" xsi:noNamespaceSch
1 row selected.
SQL>
SQL> drop table myTable;
Table dropped.
Related examples in the same category