I have a table in Oracle:
CREATE TABLE foo (id NUMBER, document XMLType)
and I would typically insert data into it with SQL:
INSERT INTO foo VALUES (1, XMLType('<parent><child></child></parent>'))
However, I now have a document which is more than the maximum size for a string literal in PL/SQL (4000 characters). Is it possible to insert such a document in a single SQL script, without resorting to writing it to a file and then referencing that file in the sql... as that option is not open to us for reasons. I have tried:
- inserting 4000 characters, then appending the rest in chunks - this does not work as the intermediate steps fail XML validation
- temporarily changing the column type to
CLOBetc. - Oracle forbids the conversion of columns between major types.