insert into varchar2 column select from xmltype column: extremely slow insert into varchar2 column select from xmltype column: extremely slow oracle oracle

insert into varchar2 column select from xmltype column: extremely slow


You have defined the KEYWOR column as an XMLTYPE. Why is that? The whole point of XMLTABLE is to convert XML structures into relational columns. If you defined the column as a simple string you could avoid a lot of unnecessary conversions.

"the contents of the tag are more than 4000 characters>>> are there any methods to substring the contents of the tag in the xmltable"

There is the XPath substring function.

insert /*+append */ into word.testwordyy(KEYWORD)select /*+ gather_plan_statistics */ b.KEWORfrom word.testmeta     , xmltable      (        '$B/mets/KEWOR'        passing        word.testmeta.XMLDATA as B        columns        KEWOR varchar2(4000) path 'substring(KEWOR, 254, 4000)'      ) b

Here I have started the substring with an offset of 254 which you use in your original post. I have also explicitly set its length to 4000.

I don't think you need to explicitly reference the text() node when declaring the column.