INSERT INTO mytab VALUES (1, XMLType(bfilename('MYXMLDIR', 'mylog.xml'), nls_charset_id('AL32UTF8')));
and I had the following exception
ERROR at line 1:
ORA-31061: XDB error: XML event error
ORA-19202: Error occurred in XML processing
In line 1 of orastream:
LPX-00225: end-element tag "txt" does not match start-element tag ""
Really I aspected this error, because I'm not sure if my "tail" command created a "well formed" XML alert log file. So I have to check it.
Now I can do a new insert
Ouch! Another error: LPX-00245. If I check the contents of the log.xml....
...there is a TAG </msg>", but it appears more times, so it isn't a root node. I have to add a root TAG as the first and last line. I choose "<alertlog></alertlog>" TAG
At this point, I expect that my log.xml file is well formed and that the new insert should be OK.
Yessss. I inserted my first XML row. Now I want to see what there is in this column
Only the first character are shown. This is because the XML is managed by SQL*Plus as a LONG type, so I have to modify the "long" settings
Conclusions (until now)
- The insert of an XML document into an XML column will insert just one row.
- The XML type check automatically if the XML document is well formed