Help on XML parsing into rdbms table
Hi,
I have posted here three different record, is that possible any of you give me some idea(out line) structure to get into some kind of oracle table format.
There few number of repeating blocks, which gives all the time the sequence error or if commented out may not be working.
I need to extract all values, but all I am expecting as a great help is some outline (atleast one column(s)) to each repeating block, then I will fill other columns
DB Version
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
record 1
<?xml version="1.0" encoding="WINDOWS-1252"?>
<item title="496S00017" maxattempts="0">
<itemmetadata>
<object_id>_140939_1</object_id>
<asitype>Item</asitype>
<extracred>false</extracred>
<absolutea>10.0</absolutea>
<tornotes>a
</tornotes>
</itemmetadata>
<presentation>
<flow class="Block">
<flow class="QUESTION_BLOCK">
<flow class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML">What general <br /><br />(Select all that apply)<br /> </mat_formattedtext>
</mat_extension>
</material>
</flow>
</flow>
<flow class="RESPONSE_BLOCK">
<response_lid ident="response" rcardinality="Multiple" rtiming="No">
<render_choice shuffle="No" minnumber="0" maxnumber="0">
<flow_label class="Block">
<response_label ident="d43d7c6bc8bb4b2fbed08fff7d99c149" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML">Ensure a .<br /> </mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="9bc429d7a4ff44b984d5e0fc5ba75d30" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML">Wear .<br /> </mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="76e38c48c7464e5aa76de83e575e15c4" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML">Maintain .<br /> </mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="fbbd2d296e3d47239dd23d1371657381" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML">Do .<br /> </mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="bcde31a42b5241bb86e52ecf5d2736d9" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML">Avoid .<br /> </mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
</render_choice>
</response_lid>
</flow>
</flow>
</presentation>
<resprocessing scoremodel="SumOfScores">
<outcomes>
<decvar varname="SCORE" vartype="Decimal" defaultval="0.0" minvalue="0.0" maxvalue="10.0"/>
</outcomes>
<respcondition title="correct">
<conditionvar>
<and>
<varequal respident="response" case="No">d43d7c6bc8bb4b2fbed08fff7d99c149</varequal>
<not>
<varequal respident="response" case="No">9bc429d7a4ff44b984d5e0fc5ba75d30</varequal>
</not>
<varequal respident="response" case="No">76e38c48c7464e5aa76de83e575e15c4</varequal>
<varequal respident="response" case="No">fbbd2d296e3d47239dd23d1371657381</varequal>
<not>
<varequal respident="response" case="No">bcde31a42b5241bb86e52ecf5d2736d9</varequal>
</not>
</and>
</conditionvar>
<setvar variablename="SCORE" action="Set">SCORE.max</setvar>
<displayfeedback linkrefid="correct" feedbacktype="Response"/>
</respcondition>
<respcondition title="incorrect">
<conditionvar>
<other/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0.0</setvar>
<displayfeedback linkrefid="incorrect" feedbacktype="Response"/>
</respcondition>
</resprocessing>
<itemfeedback ident="correct" view="All">
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</itemfeedback>
<itemfeedback ident="incorrect" view="All">
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</itemfeedback>
<itemfeedback ident="d43d7c6bc8bb4b2fbed08fff7d99c149" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="9bc429d7a4ff44b984d5e0fc5ba75d30" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="76e38c48c7464e5aa76de83e575e15c4" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="fbbd2d296e3d47239dd23d1371657381" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="bcde31a42b5241bb86e52ecf5d2736d9" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
</item>
record 2
<?xml version="1.0" encoding="WINDOWS-1252"?>
<item title="496S00038" maxattempts="0">
<itemmetadata>
<object_id>_155451_1</object_id>
<asitype>Item</asitype>
<bbmd_questiontype>Multiple Choice</bbmd_questiontype>
<extracred>false</extracred>
<absolutea>10.0</absolutea>
<tornotes>Z
</tornotes>
</itemmetadata>
<presentation>
<flow class="Block">
<flow class="QUESTION_BLOCK">
<flow class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><p>This next choice.</p><p><br />Your landmark. </p></mat_formattedtext>
</mat_extension>
</material>
</flow>
</flow>
<flow class="RESPONSE_BLOCK">
<response_lid ident="response" rcardinality="Single" rtiming="No">
<render_choice shuffle="No" minnumber="0" maxnumber="0">
<flow_label class="Block">
<response_label ident="0c72cf2736f54d9ab6da93555f023339" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><div><embed src= "@[email protected]@X@bbcswebdav/xid-1220031_1" type= "application/x-shockwave-flash"> </div></mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="f27a2e848a694b1c920bf94d1e66316a" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><div><embed src= "@[email protected]@X@bbcswebdav/xid-1220032_1" type= "application/x-shockwave-flash"> </div></mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="49a1aabd4b1e4305b38a43c50d41ba41" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><div><embed src= "@[email protected]@X@bbcswebdav/xid-1220033_1" type= "application/x-shockwave-flash"> </div></mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="a5ff047407d741ed9ad68790332afcc9" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><div><embed src= "@[email protected]@X@bbcswebdav/xid-1220034_1" type= "application/x-shockwave-flash"> </div></mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
</render_choice>
</response_lid>
</flow>
</flow>
</presentation>
<resprocessing scoremodel="SumOfScores">
<outcomes>
<decvar varname="SCORE" vartype="Decimal" defaultval="0.0" minvalue="0.0" maxvalue="10.0"/>
</outcomes>
<respcondition title="correct">
<conditionvar>
<varequal respident="response" case="No">49a1aabd4b1e4305b38a43c50d41ba41</varequal>
</conditionvar>
<setvar variablename="SCORE" action="Set">SCORE.max</setvar>
<displayfeedback linkrefid="correct" feedbacktype="Response"/>
</respcondition>
<respcondition title="incorrect">
<conditionvar>
<other/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0.0</setvar>
<displayfeedback linkrefid="incorrect" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="0c72cf2736f54d9ab6da93555f023339" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0</setvar>
<displayfeedback linkrefid="0c72cf2736f54d9ab6da93555f023339" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="f27a2e848a694b1c920bf94d1e66316a" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0</setvar>
<displayfeedback linkrefid="f27a2e848a694b1c920bf94d1e66316a" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="49a1aabd4b1e4305b38a43c50d41ba41" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">10</setvar>
<displayfeedback linkrefid="49a1aabd4b1e4305b38a43c50d41ba41" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="a5ff047407d741ed9ad68790332afcc9" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0</setvar>
<displayfeedback linkrefid="a5ff047407d741ed9ad68790332afcc9" feedbacktype="Response"/>
</respcondition>
</resprocessing>
<itemfeedback ident="correct" view="All">
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</itemfeedback>
<itemfeedback ident="incorrect" view="All">
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</itemfeedback>
<itemfeedback ident="0c72cf2736f54d9ab6da93555f023339" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="f27a2e848a694b1c920bf94d1e66316a" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="49a1aabd4b1e4305b38a43c50d41ba41" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="a5ff047407d741ed9ad68790332afcc9" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
</item>
record 3
<?xml version="1.0" encoding="UTF-8"?>
<item title="496S00070" maxattempts="0">
<itemmetadata>
<object_id>37041578</object_id>
<asitype>Item</asitype>
<qmd_instructornotes>IS
</qmd_instructornotes>
</itemmetadata>
<presentation>
<flow class="Block">
<flow class="QUESTION_BLOCK">
<flow class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><font size="2">Base </mat_formattedtext>
</mat_extension>
</material>
</flow>
</flow>
<flow class="RESPONSE_BLOCK">
<response_lid ident="response" rcardinality="Single" rtiming="No">
<render_choice shuffle="No" minnumber="0" maxnumber="0">
<flow_label class="Block">
<response_label ident="2513bfab92b14dce82f014fdb667730a" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><!mso-bidi-theme-font:minor-bidi;} </style> <![endif]--> </mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="7498293ce4ef4891984bcdbad2bc8c1d" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><!mso-bidi-theme-font:minor-bidi;} </style> <![endif]-->
</mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="c5fb333685144ab6b35848998667239d" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><!mso-bidi-theme-font:minor-bidi;} </style> <![endif]--></mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
<flow_label class="Block">
<response_label ident="419fa8003e4d4d128e664f0d9c9d106e" shuffle="Yes" rarea="Ellipse" rrange="Exact">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"><!mso-bidi-theme-font:minor-bidi;} </style> <![endif]--></mat_formattedtext>
</mat_extension>
</material>
</flow_mat>
</response_label>
</flow_label>
</render_choice>
</response_lid>
</flow>
</flow>
</presentation>
<resprocessing scoremodel="SumOfScores">
<outcomes>
<decvar varname="SCORE" vartype="Decimal" defaultval="0" minvalue="0.0" maxvalue="10.0"/>
</outcomes>
<respcondition title="correct">
<conditionvar>
<varequal respident="response" case="No">7498293ce4ef4891984bcdbad2bc8c1d</varequal>
</conditionvar>
<setvar variablename="SCORE" action="Set">SCORE.max</setvar>
<displayfeedback linkrefid="correct" feedbacktype="Response"/>
</respcondition>
<respcondition title="incorrect">
<conditionvar>
<other/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0.0</setvar>
<displayfeedback linkrefid="incorrect" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="2513bfab92b14dce82f014fdb667730a" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0</setvar>
<displayfeedback linkrefid="2513bfab92b14dce82f014fdb667730a" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="7498293ce4ef4891984bcdbad2bc8c1d" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">10</setvar>
<displayfeedback linkrefid="7498293ce4ef4891984bcdbad2bc8c1d" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="c5fb333685144ab6b35848998667239d" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0</setvar>
<displayfeedback linkrefid="c5fb333685144ab6b35848998667239d" feedbacktype="Response"/>
</respcondition>
<respcondition>
<conditionvar>
<varequal respident="419fa8003e4d4d128e664f0d9c9d106e" case="No"/>
</conditionvar>
<setvar variablename="SCORE" action="Set">0</setvar>
<displayfeedback linkrefid="419fa8003e4d4d128e664f0d9c9d106e" feedbacktype="Response"/>
</respcondition>
</resprocessing>
<itemfeedback ident="correct" view="All">
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</itemfeedback>
<itemfeedback ident="incorrect" view="All">
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</itemfeedback>
<itemfeedback ident="2513bfab92b14dce82f014fdb667730a" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="7498293ce4ef4891984bcdbad2bc8c1d" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="c5fb333685144ab6b35848998667239d" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
<itemfeedback ident="419fa8003e4d4d128e664f0d9c9d106e" view="All">
<solution view="All" feedbackstyle="Complete">
<solutionmaterial>
<flow_mat class="Block">
<flow_mat class="FORMATTED_TEXT_BLOCK">
<material>
<mat_extension>
<mat_formattedtext type="HTML"/>
</mat_extension>
</material>
</flow_mat>
</flow_mat>
</solutionmaterial>
</solution>
</itemfeedback>
</item>Any help would be greatly appreciated.
Thanks,
Hi,
Yes, I have tried the same method. will be ok.
But I have got another some records on the same column as follows.
I have tried with another one xmltable with outer join(+), still not getting the actual data (null record from the original(main) table) and extra records from the new xmltable.
Is it possible to make one or union with xmltable also can we check the node either /Item or /section exists something like that
<?xml version="1.0" encoding="WINDOWS-1252"?>
<section>
<sectionmetadata>
<object_id>317832</object_id>
<asitype>Section</asitype>
<instructornotes/>
</sectionmetadata>
<selection_ordering>
<selection seltype="All">
<selection_number>1</selection_number>
<or_selection>
<selection_metadata mdoperator="EQ" mdname="questionid">_155451_1</selection_metadata>
</or_selection>
</selection>
<selection seltype="All">
<or_selection>
<selection_param pname="singleLink">true</selection_param>
</or_selection>
</selection>
</selection_ordering>
</section>Thanks,
Similar Messages
-
How to load a XML file into a table
Hi,
I've been working on Oracle for many years but for the first time I was asked to load a XML file into a table.
As an example, I've found this on the web, but it doesn't work
Can someone tell me why? I hoped this example could help me.
the file acct.xml is this:
<?xml version="1.0"?>
<ACCOUNT_HEADER_ACK>
<HEADER>
<STATUS_CODE>100</STATUS_CODE>
<STATUS_REMARKS>check</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>2</SEGMENT_NUMBER>
<REMARKS>rp polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>3</SEGMENT_NUMBER>
<REMARKS>rp polytechnic administration</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>4</SEGMENT_NUMBER>
<REMARKS>rp polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>5</SEGMENT_NUMBER>
<REMARKS>rp polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
<HEADER>
<STATUS_CODE>500</STATUS_CODE>
<STATUS_REMARKS>process exception</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>20</SEGMENT_NUMBER>
<REMARKS> base polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>30</SEGMENT_NUMBER>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>40</SEGMENT_NUMBER>
<REMARKS> base polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>50</SEGMENT_NUMBER>
<REMARKS> base polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
</ACCOUNT_HEADER_ACK>
For the two tags HEADER and DETAILS I have the table:
create table xxrp_acct_details(
status_code number,
status_remarks varchar2(100),
segment_number number,
remarks varchar2(100)
before I've created a
create directory test_dir as 'c:\esterno'; -- where I have my acct.xml
and after, can you give me a script for loading data by using XMLTABLE?
I've tried this but it doesn't work:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS[$hn]/DETAIL'
passing acct_doc as "d",
x1.header_no as "hn"
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
This should allow me to get something like this:
select * from xxrp_acct_details;
Statuscode status remarks segement remarks
100 check 2 rp polytechnic
100 check 3 rp polytechnic administration
100 check 4 rp polytechnic finance
100 check 5 rp polytechnic logistics
500 process exception 20 base polytechnic
500 process exception 30
500 process exception 40 base polytechnic finance
500 process exception 50 base polytechnic logistics
but I get:
Error report:
ORA-06550: line 19, column 11:
PL/SQL: ORA-00932: inconsistent datatypes: expected - got NUMBER
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
and if I try to change the script without using the column HEADER_NO to keep track of the header rank inside the document:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'/ACCOUNT_HEADER_ACK/DETAILS'
passing acct_doc
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
I get this message:
Error report:
ORA-19114: error during parsing the XQuery expression:
ORA-06550: line 1, column 13:
PLS-00201: identifier 'SYS.DBMS_XQUERYINT' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06512: at line 4
19114. 00000 - "error during parsing the XQuery expression: %s"
*Cause: An error occurred during the parsing of the XQuery expression.
*Action: Check the detailed error message for the possible causes.
My oracle version is 10gR2 Express Edition
I do need a script for loading xml files into a table as soon as possible, Give me please a simple example for understanding and that works on 10gR2 Express Edition
Thanks in advance!The reason your first SQL statement
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS[$hn]/DETAIL'
passing acct_doc as "d",
x1.header_no as "hn"
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
returns the error you noticed
PL/SQL: ORA-00932: inconsistent datatypes: expected - got NUMBER
is because Oracle is expecting XML to be passed in. At the moment I forget if it requires a certain format or not, but it is simply expecting the value to be wrapped in simple XML.
Your query actually runs as is on 11.1 as Oracle changed how that functionality worked when 11.1 was released. Your query runs slowly, but it does run.
As you are dealing with groups, is there any way the input XML can be modified to be like
<ACCOUNT_HEADER_ACK>
<ACCOUNT_GROUP>
<HEADER>....</HEADER>
<DETAILS>....</DETAILS>
</ACCOUNT_GROUP>
<ACCOUNT_GROUP>
<HEADER>....</HEADER>
<DETAILS>....</DETAILS>
</ACCOUNT_GROUP>
</ACCOUNT_HEADER_ACK>
so that it is easier to associate a HEADER/DETAILS combination? If so, it would make parsing the XML much easier.
Assuming the answer is no, here is one hack to accomplish your goal
select x1.status_code,
x1.status_remarks,
x3.segment_number,
x3.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS'
passing acct_doc as "d",
columns detail_no for ordinality,
detail_xml xmltype path 'DETAIL'
) x2,
xmltable(
'DETAIL'
passing x2.detail_xml
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS') x3
WHERE x1.header_no = x2.detail_no;
This follows the approach you started with. Table x1 creates a row for each HEADER node and table x2 creates a row for each DETAILS node. It assumes there is always a one and only one association between the two. I use table x3, which is joined to x2, to parse the many DETAIL nodes. The WHERE clause then joins each header row to the corresponding details row and produces the eight rows you are seeking.
There is another approach that I know of, and that would be using XQuery within the XMLTable. It should require using only one XMLTable but I would have to spend some time coming up with that solution and I can't recall whether restrictions exist in 10gR2 Express Edition compared to what can run in 10.2 Enterprise Edition for XQuery. -
How to load a XML file into a table using PL/SQL
Hi Guru,
I have a requirement, that i have to create a procedure or a package in PL/SQL to load XML file into a table.
How we can achive this.ODI_NewUser wrote:
Hi Guru,
I have a requirement, that i have to create a procedure or a package in PL/SQL to load XML file into a table.
How we can achive this.
Not a perfectly framed question. How do you want to load the XML file? Hoping you want to parse the xml file and load it into a table you can do this.
This is the xml file
karthick% cat emp_details.xml
<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7782</EMPNO>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>09-JUN-1981</HIREDATE>
<SAL>2450</SAL>
<COM>0</COM>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7839</EMPNO>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
<HIREDATE>17-NOV-1981</HIREDATE>
<SAL>5000</SAL>
<COM>0</COM>
<DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>
You can write a query like this.
SQL> select *
2 from xmltable
3 (
4 '/ROWSET/ROW' passing xmltype
5 (
6 bfilename('SDAARBORDIRLOG', 'emp_details.xml')
7 , nls_charset_id('AL32UTF8')
8 )
9 columns empno number path 'EMPNO'
10 , ename varchar2(6) path 'ENAME'
11 , job varchar2(9) path 'JOB'
12 , mgr number path 'MGR'
13 , hiredate varchar2(20)path 'HIREDATE'
14 , sal number path 'SAL'
15 , com number path 'COM'
16 , deptno number path 'DEPTNO'
17 );
EMPNO ENAME JOB MGR HIREDATE SAL COM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-1981 2450 0 10
7839 KING PRESIDENT 17-NOV-1981 5000 0 10
SQL> -
How to convert xml file into internal table in ABAP Mapping.
Hi All,
I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
<BookingCode>2KY34R</BookingCode>
- <Passenger>
<Name>SARVESH</Name>
<Address>THANE</Address>
</Passenger>
- <Passenger>
<Name>RAJESH</Name>
<Address>POWAI</Address>
</Passenger>
- <Passenger>
<Name>CARRON</Name>
<Address>JUHU</Address>
</Passenger>
- <Flight>
<Date>03/03/07</Date>
<AirlineID>UA</AirlineID>
<FlightNumber>125</FlightNumber>
<From>LAS</From>
<To>SFO</To>
</Flight>
</ns0:MTO_ABAP_MAPPING>
AT the receiver side I wnat to concatenate the NAME & ADDRESS.
I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
but couldnt succeed to convert the xml file into internal table perfectly.
Can anybody help on this.
Thanks in advance!!
SarveshHi Sarvesh,
The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
Just in case you have not seen this
regards
Vijaya -
Loading XML file into DB Table
Hi
I m quite new to the loading XML file into database table.
It will be great if anyone could guide me to through.
Now,
i have an XML file which has to be loaded into the DB table.
what are the steps involved in doing this. How do i go from here ??
your help is greatly appriciated ???
Thank you so much!!
-ShashiOK - Although you really should read the XMLDB FAQ on this forum, here is some sample code of ONE of the ways of doing it
(there are multiple ways - and this is not the most simple one)
Based on Oracle 11gR1
-- sqlplus /nolog
clear screen
set termout on
set feed on
set lines 40
set long 10000000
set serveroutput on
set lines 100
set echo on
connect / as sysdba
col filename for a80
col xml for a80
-- Create schema “OTN”
drop user OTN cascade;
purge dba_recyclebin;
create user OTN identified by OTN;
grant dba, xdbadmin to OTN;
EXECUTE dbms_java.grant_permission( 'OTN', 'java.io.FilePermission','G:\OTN\xmlstore','read' );
prompt pause
pause
clear screen
-- Create directory
connect OTN/OTN;
show user
drop directory OTN_USE_CASE;
CREATE directory OTN_USE_CASE AS 'G:\OTN\xmlstore';
SELECT extract((XMLTYPE(bfilename('OTN_USE_CASE','ABANDA-20030407215829881GMT.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
from dual;
prompt pause
pause
clear screen
-- Directory Listing - Tom Kyte
create global temporary table DIR_LIST
( filename varchar2(255) )
on commit delete rows
create or replace
and compile java source named "DirList"
as
import java.io.*;
import java.sql.*;
public class DirList
{public static void getList(String directory)
throws SQLException
{ File path = new File( directory );
String[] list = path.list();
String element;
for(int i = 0; i < list.length; i++)
{ element = list;
#sql { INSERT INTO DIR_LIST (FILENAME)
VALUES (:element) };
create or replace procedure get_dir_list( p_directory in varchar2 )
as language java
name 'DirList.getList( java.lang.String )';
prompt pause
pause
clear screen
-- The content of the global temporary table
exec get_dir_list( 'G:\OTN\xmlstore' );
select * from dir_list;
-- "COMMIT" will clear / truncate the global temporary table...
prompt pause
pause
clear screen
-- Combined: Reading XML content from multiple XML files
commit;
exec get_dir_list( 'G:\OTN\xmlstore' );
select * from dir_list where filename like '%.xml'
and rownum <= 10;
prompt pause
pause
clear screen
select extract((XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
from dir_list dl
where dl.filename like '%.xml' and rownum <= 2;
prompt pause
pause
clear screen
-- If you can select it you can insert it...
-- drop table OTN_xml_store purge;
create table OTN_xml_store of xmltype
xmltype store as binary xml
commit;
exec get_dir_list( 'G:\OTN\xmlstore' );
set time on timing on
insert into OTN_xml_store
select XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
from dir_list dl
where dl.filename like '%.xml';
set time off timing off
commit;
select count(*) from OTN_xml_store;
prompt pause
pause
clear screen
-- If you can select it you can create resources and files
set time on timing on
commit;
exec get_dir_list( 'G:\OTN\xmlstore' );
select count(*) from dir_list where filename like '%.xml';
set serveroutput on size 10000
DECLARE
XMLdoc XMLType;
res BOOLEAN;
v_foldername varchar2(4000) := '/public/OTN/';
cursor c1
is
select dl.filename FNAME
, XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
from dir_list dl
where dl.filename like '%.xml'
and rownum <= 100;
BEGIN
-- Create XDB repository Folder
if (dbms_xdb.existsResource(v_foldername))
then
dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
end if;
res:=DBMS_XDB.createFolder(v_foldername);
-- Create XML files in the XDB Repository
for r1 in c1
loop
if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
then
dbms_output.put_line(v_foldername||r1.fname);
null;
else
dbms_output.put_line('Loop Exception :'||sqlerrm);
end if;
end loop;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Others Exception: '||sqlerrm);
END;
set time off timing off
commit;
prompt pause
pause
clear screen
-- FTP and HTTP
clear screen
prompt
prompt *** FTP - Demo ***
prompt
prompt pause
pause
host ftp
-- open localhost 2100
-- user OTN OTN
-- cd public
-- cd OTN
-- ls
-- bye
clear screen
prompt
prompt *** Microsoft Internet Explorer - Demo ***
prompt
prompt pause
pause
host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OTN:OTN@localhost:8080/public/OTN/
prompt pause
pause
-- Accessing the XDB Repository content via Resource View
-- Selecting content from a resource via XBDUriType
clear screen
prompt set long 300
set long 300
prompt Relative Path - (path)
SELECT path(1) as filename
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OTN', 1) = 1
and rownum <= 10
prompt pause
pause
clear screen
prompt Absolute Path - (any_path)
select xdburitype(any_path).getClob() as xml
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OTN', 1) = 1
and rownum <= 1;
prompt pause
pause
-- CLEANUP ENVIRONMENT
clear screen
prompt
prompt >>>>> Clean UP !!! <<<<<<
prompt
prompt Cleanup environment and drop user...!!!
prompt
pause
clear screen
conn / as sysdba
alter session set current_schema=OTN;
begin
dbms_xdb.deleteResource('/public/OTN',dbms_xdb.DELETE_RECURSIVE_FORCE);
commit;
end;
alter session set current_schema=sys;
drop user OTN cascade;
Based on http://www.liberidu.com/blog/?p=1053 -
How to load xml data into a table
Hi,
i am a newbie. I want to insert the data of xml file into a table. I am doing this using XSU api for java.
I am using oracle 9i and jdk 1.7.
I am using OracleXmlSave class.
but i am getting following error.
java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
Please help in this regard. this is my first thread.
thanks.
Edited by: 979682 on Jan 3, 2013 3:39 AMHi,
You can insert XML data from XML file to Oracle database by this script :
Hi,
For reading and inserting the data from XML file to Oracle Database :
1. CREATE A BLANK TABLE with same structure as XML file :
select * from xml_test
2. SELECT QUERY DIRECTLY ON XML FILE :
SELECT XMLTYPE(bfilename('TEST_DIR', 'data_file.xml'), nls_charset_id('UTF8')) xml_data FROM dual
3. CREATE ORACLE DIRECTORY AND PLACE XML FILE IN THIS DIRECTORY LOCATION:
--CREATE DIRECTORY TEST_DIR as '/oracle/test';
--grant all on directory TEST_DIR to public;
4. INSERT THE XML DATA IN ORACLE TABLE:
INSERT INTO xml_test(column1,coumn2)
WITH t AS (SELECT XMLTYPE(bfilename('TEST_DIR', 'attachment.xml'), nls_charset_id('UTF8')) xml_col FROM dual)
SELECT
extractValue(value(x),'/ROW/COLUMN1') column1
,extractValue(value(x),'ROW/COLUMN2') column2
FROM t,TABLE(XMLSequence(extract(t.xml_col,'/ROWSET/ROW'))) x;
I have assumed a table with 2 columns.
Regards,
Rohit Chaudhari
[email protected] -
How to store XML data into Oracle Table
I had trouble to store XML data into Oracle Table with XDK (Oracle 8.1.7 ). The error is:
C:\XDK_Java_9_2\xdk\demo\java\Test>java testInsert Dept.xml
<Line 1, Column 1>: XML-0108: (Fatal Error) Start of root element expected.
Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2263)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1333)
at testInsert.main(testInsert.java:8)
Here is my xml file:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DEPTNO>10</DEPTNO>
<DNAME>ACCOUNTING</DNAME>
<LOC>NEW YORK</LOC>
</ROW>
<ROW num="2">
<DEPTNO>20</DEPTNO>
<DNAME>RESEARCH</DNAME>
<LOC>DALLAS</LOC>
</ROW>
<ROW num="3">
<DEPTNO>30</DEPTNO>
<DNAME>SALES</DNAME>
<LOC>CHICAGO</LOC>
</ROW>
<ROW num="4">
<DEPTNO>40</DEPTNO>
<DNAME>OPERATIONS</DNAME>
<LOC>BOSTON</LOC>
</ROW>
</ROWSET>
and here is structure of table:
Name Null? Type
DEPTNO NOT NULL NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
and here is my Java Code:
import java.sql.*;
import oracle.xml.sql.dml.OracleXMLSave;
public class testInsert{
public static void main(String[] args) throws SQLException{
Connection conn = getConnection();
OracleXMLSave sav = new OracleXMLSave(conn,"scott.tmp_dept");
sav.insertXML(args[0]);
sav.close();
conn.close();
private static Connection getConnection()throws SQLException{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@amt-ebdev01:1521:mydept","scott","tiger");
return conn;
Could you help me ? Thanks !The problem is that you need to pass avalid URL , Document...
Please try this code instead:
import java.net.*;
import java.sql.*;
import java.io.*;
import oracle.xml.sql.dml.OracleXMLSave;
public class testInsert
public static void main(String[] args) throws SQLException{
Connection conn = getConnection();
OracleXMLSave sav = new OracleXMLSave(conn,"scott.temp_dept");
URL url = createURL(args[0]);
sav.insertXML(url);
sav.close();
conn.close();
private static Connection getConnection()throws SQLException{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@dlsun1982:1521:jwxdk9i","scott","tiger");
return conn;
// Helper method to create a URL from a file name
static URL createURL(String fileName)
URL url = null;
try
url = new URL(fileName);
catch (MalformedURLException ex)
File f = new File(fileName);
try
String path = f.getAbsolutePath();
// This is a bunch of weird code that is required to
// make a valid URL on the Windows platform, due
// to inconsistencies in what getAbsolutePath returns.
String fs = System.getProperty("file.separator");
if (fs.length() == 1)
char sep = fs.charAt(0);
if (sep != '/')
path = path.replace(sep, '/');
if (path.charAt(0) != '/')
path = '/' + path;
path = "file://" + path;
url = new URL(path);
catch (MalformedURLException e)
System.out.println("Cannot create url for: " + fileName);
System.exit(0);
return url; -
Loading an XML file into the table without creating a directory .
Hi,
I wanted to load an XML file into a table column . But I should not create a directory in the server and placing the XML file there and giving the path in the insert query. Can anybody help me here?
Thanks in advance.You could write a java stored procedure that retrieves the file into a clob. Wrap that in a function call and use it in your insert statement.
This solution require read privileges granted by sys and is therefore only feasible if the top-level directory/directories are known or you get read-access to everything. -
To load an XML document into 40 tables
How do I load a large XML document into 40 tables. Most of the exmaples, I see only load one table into the Orcale database?
From the above document:
Storing XML Data Across Tables
Question
Can XML- SQL Utility store XML data across tables?
Answer
Currently XML-SQL Utility (XSU) can only store to a single table. It maps a canonical representation of an XML document into any table/view. But of course there is a way to store XML with the XSU across table. One can do this using XSLT to transform any document into multiple documents and insert them separately. Another way is to define views over multiple tables (object views if needed) and then do the inserts ... into the view. If the view is inherently non-updatable (because of complex joins, ...), then one can use INSTEAD-OF triggers over the views to do the inserts.
-- I've tried this, works fine. -
Pleasee Help , Urgent , XML Parsing
We should upload Sales Order XML File into OA Tables everyday .
As I am very new to XML I request to give complete sample code ( giving just the logic needs time to understand, very urgent..)
The current XML File can have mutilpe one sales order and each sales order can have many lines .Each line can have multiple taxes.
Pls give the sample Code which you think is the best approach.
I have used xpath(may not be right)
I want to insert Parent Node / Child Node / Grand Child Done as one set of data.
I used Xpath syntax , when I give the Parent node path in for loop, it inserts all parent nodes data at one time into the table , similarly all child nodes at one time .
So I am unable to link grand child record with child record and parent record.
To be specific , I am unable to trace these are the tax records for this line from this order.
I have used xpath. I have loaded the xml file into table with clob variable
l_OrderRequest_nodelist := xslprocessor.selectNodes(xmldom.makeNode(l_doc), '/Recordset');
FOR rec IN 0 .. xmldom.getlength(l_OrderRequest_nodelist) -1 loop l_OrderRequest_node := xmldom.item(l_OrderRequest_nodelist,
rec);
end loop;
we are not validating Sales order XML File with DTD or XSD .
Please give sample code for parent / child /grandchild .
Below is the sample file.
- <Recordset>
- <Header dueDate="2007-01-17T16:09:05" orderDate="2004-01-17" orderID="0009" transactionID="1389" type="new">
<KeyIndex>2</KeyIndex>
- <BillTo>
- <Address addressID="5619" isoCountryCode="US">
<Name>fMat</Name>
- <PostalAddress name="default">
<Street>34545</Street>
<City>dfgfg</City>
<State>AZ</State>
<PostalCode>85086-1693</PostalCode>
<County>Maricopa</County>
<Country>US</Country>
</PostalAddress>
<Email name="default">[email protected]</Email>
</Address>
</BillTo>
<PromotionCode />
- <SubTotal>
<Money currency="USD">32.49</Money>
</SubTotal>
- <Tax>
<Money currency="USD">2.32</Money>
<Description />
</Tax>
- <Shipping>
<Money currency="USD">8.95</Money>
<Description />
</Shipping>
</Header>
- <Detail lineNumber="1" quantity="1">
- <ItemDetail>
- <UnitPrice>
<Money currency="USD">29.99</Money>
</UnitPrice>
<ShortName>Little;reg; pxxxx® Learning System</ShortName>
</ItemDetail>
- <Tax>
<Money currency="USD">1.68</Money>
<Description />
- <TaxDetail category="sales">
- <TaxAmount>
<Money currency="USD">1.68</Money>
</TaxAmount>
<TaxLocation>AZ</TaxLocation>
</TaxDetail>
</Tax>
</Detail>
- <Detail lineNumber="2" quantity="1">
- <ItemDetail>
- <UnitPrice>
<Money currency="USD">29.99</Money>
</UnitPrice>
<ShortName>Little;reg; pxxxx® Learning System</ShortName>
</ItemDetail>
- <Tax>
<Money currency="USD">1.68</Money>
<Description />
- <TaxDetail category="sales">
- <TaxAmount>
<Money currency="USD">1.68</Money>
</TaxAmount>
<TaxLocation>AZ</TaxLocation>
</TaxDetail>
</Tax>
- <Tax>
<Money currency="USD">0.68</Money>
<Description />
- <TaxDetail category="sales">
- <TaxAmount>
<Money currency="USD">0.68</Money>
</TaxAmount>
<TaxLocation>DISTRICT</TaxLocation>
</TaxDetail>
</Tax>
</Detail>
</Recordset>
We are working on Oracle9i Enterprise Edition Release 9.2.0.6.0
Thanks in Adv
Kalvery urgent..Unfortunately, there are 36 other urgent requests before yours.
-
XML document into multiple tables
How to insert a xml document into multiple tables. Eg. Purchase Order having multiple line items. I have to insert xml document into Parent as well as child with different sets of columns.
I created the tables using the create_ch14_tables.sql. I call it using java -classpath .;C:\commerceone\xpc\lib\xmlparserv2.jar;C:\commerceone\xpc\lib\classes12.zip;C:\commerceone\xpc\lib\xsu12.jar XMLLoader -file deptempdepend.xml -connName default -transform deptempdepend.xsl. The code doesn't seem to like the "<xsl:for-each select="Department">" tags. If I remove them, the insDoc.getDocumentElement().getFirstChild() will find the element, but it still doesn't insert anything into the database.
Thank You,
Dave -
Loading XML files into Database table
Loading XML files into Database table
Hi I have some XML files say 100 files in a virtual directory created using "Create or replace directory command" and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packagesCheck out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
Ben -
Importing data- using xml file into HANA Table
Hi,
We are using (HDB STUDIO ) - revision 60.......
Is it possible to import data using XML file into HANA table (Master,Fact tables)?
(Without using any intermediate adapters for conversion of data.....)
Can any one suggest us........
Thank you.Hi user450616
I am a bit confused about what you are trying to achieve.
Are you:
1. importing a CSV file into APEX
2. adding an extra column to the Oracle Table
3. populating the extra column with the CSV filename?
Let us know if this is what you are trying to do.
Cheers,
Patrick Cimolini -
Loading xml data into eexternal table
emp.xml is xml file namewhich is saved in C:\Documents and Settings\james\Desktop\emp.xml
xml file
<EMPLOYEES>
<EMP>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
</EMP>
<EMP>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
</EMP>
</EMPLOYEES>
CREATE DIRECTORY my_xml_dir AS 'C:\Documents and Settings\james\Desktop\emp.xml'
CREATE TABLE my_xml_et ( EMPNO NUMBER, EMPNAME VARCHAR2(10), JOB VARCHAR2(10), HIREDATE DATE, SAL NUMBER )
using external tables how this xml data is loaded into my_xml_etI think you mean you are trying to load an XML from/using an external table.
However, external tables are typically best suited to flat file structures rather than XML nested structures.
What you require is one of the many techniques for shredding an XML document into oracle table structures.
More information on these techniques can be found in the XML DB forum, with plenty of useful links in the FAQ for that forum...
XML DB FAQ -
Inserting XML file into a Table
Hello,
Can someone provide me with a sample code to load xml files into a table. Thanks a lot.
RajeeshKeeping my fingers crossed that this quote from "Building XML Oracle Applications" by Steve Muench (O'Reilly & Associates, 2000, ISBN 1-56592-691-9) falls into the "fair use" category, and that you want it in PL/SQL, here is a procedure:
PROCEDURE insertXMLFile
(dir VARCHAR2, file VARCHAR2, name VARCHAR2 := NULL) IS
theBFile BFILE;
theCLob CLOB;
theDocName VARCHAR2(200) := NVL(name,file);
BEGIN
-- (1) Insert a new row into xml_documents with an empty CLOB, and
-- (2) Retrieve the empty CLOB into a variable with RETURNING.INTO
INSERT INTO stylesheets(docname,sheet) VALUES(theDocName,empty_clob( ))
RETURNING sheet INTO theCLob;
-- (3) Get a BFile handle to the external file
theBFile := BFileName(dir,file);
-- (4) Open the file
dbms_lob.fileOpen(theBFile);
-- (5) Copy the contents of the BFile into the empty CLOB
dbms_lob.loadFromFile(dest_lob => theCLob, src_lob => theBFile, amount => dbms_lob.getLength(theBFile));
-- (6) Close the file and commit
dbms_lob.fileClose(theBFile);
COMMIT;
END;
Maybe you are looking for
-
Background colours in Bex.
Hi all, How can v apply the background colors to the rows and columns, other than exceptions. I know there is way thru macros but i dont know how to write the vb code for that. is der possiblity to do the same in BEx without macros plz let me know. i
-
Communication Channel types for e Filing GB
Hi radhika, For e-Filing Outgoing process the configuration Scenario is PAYE_EOY_GB. For e-Filing Incoming Process scenario is Employee_tax_code_update, In these cases, GovernmentGateway is as sender for -Filing Incoming Process and is as receiver
-
Weird Spry Submenu Effect in Internet Explorer
It looks like the first category item of a Spry submenu is stretching vertically to the same length of the Spry sub sub menu to the right. It works fine in Safari and Firefox. It is only doing this in IE 8 on a pc Any idea why this might be happening
-
Crashes when resuming from standby with Bluetooth mouse
Unless I turn off my Logitech Bluetooth mouse BEFORE entering sleep, the Mac crashes completely when trying to wake it up. the screen doesn't turn on, unless I plug in an external display adapter -- in which case it just turns on into a blank blue de
-
Oracle applications and xserver
Oracle apps dbas, When I tried o view the graphics in workflow manage on OAM, always got the error: "BIB-7000 Cannot access X Server". I found the metalink note: Note:351839.1 to explain the cause. But still a little bit confused about the Oracle App