Oracle PL/SQL/XML/XML Save
Версия от 13:45, 26 мая 2010; (обсуждение)
Use to_clob to save xml string to a clob type column
SQL> create table xmldata(
2 xmldoc clob )
3 /
Table created.
SQL>
SQL> insert into xmldata values
2 ( to_clob( "<?xml version="1.0"?>
3 <ROWSET>
4 <ROW num="1">
5 <EMPNO>7</EMPNO>
6 <ENAME>S</ENAME>
7 <JOB>CLERK</JOB>
8 <MGR>7</MGR>
9 <HIREDATE>12/17/2008 0:0:0</HIREDATE>
10 <SAL>999</SAL>
11 <DEPTNO>20</DEPTNO>
12 </ROW>
13 </ROWSET>" ) )
14 /
1 row created.
SQL>
SQL> select * from xmldata;
XMLDOC
--------------------------------------------------------------------------------
<?xml version="1.0"?>
<ROWSET>
<ROW num="1">
<EMPNO>9999</EMPNO>
<ENAME>S</ENAME>
<JOB>CLERK</JOB>
<MGR>1111</MGR>
<HIREDATE>12/17/2008 0:0:0</HIREDATE>
<SAL>111</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
</ROWSET>
1 row selected.
SQL>
SQL> drop table xmldata;
Table dropped.
SQL>
SQL> --