Skip to content Skip to sidebar Skip to footer

Extract Data From XML Clob Using SQL From Oracle Database

I want to extract the value of Decision using sql from table TRAPTABCLOB having column testclob with XML stored as clob. Sample XML as below.

Solution 1:

Try

SELECT EXTRACTVALUE(xmltype(testclob), '/DCResponse/ContextData/Field[@key="Decision"]') 
FROM traptabclob;

Here is a sqlfiddle demo


Solution 2:

This should work

SELECT EXTRACTVALUE(column_name, '/DCResponse/ContextData/Decision') FROM traptabclob;

I have assumed the ** were just for highlighting?


Post a Comment for "Extract Data From XML Clob Using SQL From Oracle Database"