In a previous question, I've asked how to transform a clob into a table, see this:
From XML to list of paths in Oracle PL/SQL environment
The answer I received was great, and it works for XML not too big.
But if I have a table called MY_TABLE_ONE with a field called MY_FIELD which is a CLOB with a very large content (for example 500 Kbytes), the following statement WON'T exit in a reasonable time:
CREATE TABLE MY_TABLE_TWO
AS
WITH PARAMS AS (SELECT XMLTYPE (MY_FIELD) FROM MY_TABLE_ONE)
SELECT ELEMENT_PATH, ELEMENT_TEXT
FROM XMLTABLE (
'
for $i in $doc/descendant-or-self::*
return <element>
<element_path> {$i/string-join(ancestor-or-self::*/name(.), ''/'')} </element_path>
<element_content> {$i/text()}</element_content>
</element>
'
PASSING (SELECT * FROM PARAMS) AS "doc"
COLUMNS ELEMENT_PATH VARCHAR2 (4000) PATH '//element_path',
ELEMENT_TEXT VARCHAR2 (4000) PATH '//element_content'
);
Is there any alternative way to transform an XML stored inside CLOB column, in an Oracle table with the list of the paths and the respective values, in a more EFFICIENT way?
The above statement is right, but it needs too much time to finalize.
Thank you very much for considering my request.
No comments:
Post a Comment