How to read XML file in Stored Procedure in Oracle SQL? -


i need consume xml file folder , perform transformations on specific tag values (say eventname value "loadstopapp"), assign temp variable, , insert temp variable dummy table.

how can that, sample xml?

<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <cisdocument>     <eventname>loadstopappointment</eventname>     <reasoncode>aph_</reasoncode>     <reasoncodedescription>appointment changed</reasoncodedescription>     <systemtimezoneoffset>0.000000</systemtimezoneoffset>     <eventdatetime>2016-03-30t16:48:30</eventdatetime>     <eventreporteddatetime>2016-03-30t16:48:30</eventreporteddatetime>     <eventoccurreddatetime>2016-03-30t16:48:30</eventoccurreddatetime>  </cisdocument> 

insert dummy_table (   eventname,   reasoncode,   reasoncodedescription,   systemtimezoneoffset,   eventdatetime   -- ,... ) select extractvalue( xml, '//cisdocument/eventname' ),        extractvalue( xml, '//cisdocument/reasoncode' ),        extractvalue( xml, '//cisdocument/reasoncodedescription' ),        to_number( extractvalue( xml, '//cisdocument/systemtimezoneoffset' ) ),        to_date(          extractvalue( xml, '//cisdocument/systemtimezoneoffset' ),          'yyyy-mm-dd"t"hh24:mi:ss'        )        -- ,...   ( select xmltype( your_clob_value ) xml dual ) 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -