Query data on an XML table CLOB
Hi
I'd like to query an Oracle table to extract xml attributes on xml CLOB column's please see below table structure and how can i improve performance on this table we've already created Index.
Can you please assist on how to improve performance when querying this table and is there a better way of Querying this table??
Any suggestion's a welcomed.
DB version: 11.2.0.1.0
Table Structure
CREATE TABLE XXCUSTOM.XXWSF_AR_INTEGRATION_LOG
ID NUMBER,
TIME_RECIEVED DATE DEFAULT SYSDATE,
INPUT_MESSAGE CLOB,
RETURN_MESSAGE CLOB
CREATE INDEX APPS.TIME_RECEIVED_IDX ON XXCUSTOM.XXWSF_AR_INTEGRATION_LOG
(TIME_RECIEVED)
CREATE UNIQUE INDEX XXCUSTOM.XXWSF_AR_INTEGRATION_LOG_PK ON XXCUSTOM.XXWSF_AR_INTEGRATION_LOG
(ID)This is my xml on my input_message CLOB column and this table contain more that *700,000 records(row)*
<AR-Message-Customer arDocumentPrimaryKey="5634300">
<Customer Customer-Number="AUDJOH0000002" Cusomter-Name="AUDI JOHANNESBURG " Address-1="55 BERTHA STREET " Address-2=" " Address-3="BRAAMFONTEIN " Postal-Code="2017" City-Or-Town="JOHANNESBURG " Country="ZAF" Bank-Name="FIRST NATIONAL BANK " Bank-Account-Num="62116103988" Bank-Account-Description="WSF" Bank-Account-Name="BRETT HUDSON (PTY) LTD " Branch-Name="JOHANNESBURG BRANCH " Branch-Num="251305" Bank-Account-Start-Date="09/08/13 00:00" Org-Id="3010" Customer-Site-Name="34322">
<Invoice-Lines Customer-Number="AUDJOH0000002" Amount="4457.83" Amount-Includes-Tax-FLag="N" Currency-Code="ZAR" Document-Number="5634285" Invoice-Number="5634285" Invoice-Date="2011-03-31" Line-Number="1" Line-Type="LINE" Org-Id="3010" Quantity="1" Tax-Code="EXEMPT" Tax-Rate="0" Payment-Method="INTERNAL_TRANSFER" Company="3010" R-Company="3010" Joint-Venture="WB" R-Joint-Venture="00000" Contract="X11471=4" R-Contract="0000000" R-Dealer="AUDJOH0000002" Cost-Centre="1370000" R-Cost-Centre="1370000" Account-Code="4317301" R-Account-Code="1317310" Supplier="AUDJOH0000002" Dealer="AUDJOH0000002" Create-Invoice-Flag="N" R-Supplier="AUDJOH0000002" Customer-Site-Name="34322"/>
<Invoice-Lines Customer-Number="AUDJOH0000002" Amount="0.00" Amount-Includes-Tax-FLag="N" Currency-Code="ZAR" Document-Number="5634285" Invoice-Number="5634285" Invoice-Date="2011-03-31" Line-Number="2" Line-Type="TAX" Link-To-Line-Attribute1="1" Org-Id="3010" Quantity="1" Tax-Code="EXEMPT" Tax-Rate="0" Payment-Method="INTERNAL_TRANSFER" Company="3010" R-Company="3010" Joint-Venture="WB" R-Joint-Venture="00000" Contract="X11471=4" R-Contract="0000000" R-Dealer="AUDJOH0000002" Cost-Centre="1370000" R-Cost-Centre="1370000" Account-Code="2221675" R-Account-Code="2221675" Supplier="AUDJOH0000002" Dealer="AUDJOH0000002" Create-Invoice-Flag="N" R-Supplier="AUDJOH0000002" Customer-Site-Name="34322"/>
<Invoice-Lines Customer-Number="AUDJOH0000002" Amount="2113.16" Amount-Includes-Tax-FLag="N" Currency-Code="ZAR" Document-Number="5634285" Invoice-Number="5634285" Invoice-Date="2011-03-31" Line-Number="3" Line-Type="LINE" Org-Id="3010" Quantity="1" Tax-Code="EXEMPT" Tax-Rate="0" Payment-Method="INTERNAL_TRANSFER" Company="3010" R-Company="3010" Joint-Venture="WB" R-Joint-Venture="00000" Contract="X27206=3" R-Contract="0000000" R-Dealer="AUDJOH0000002" Cost-Centre="1370000" R-Cost-Centre="1370000" Account-Code="4317301" R-Account-Code="1317310" Supplier="AUDJOH0000002" Dealer="AUDJOH0000002" Create-Invoice-Flag="N" R-Supplier="AUDJOH0000002" Customer-Site-Name="34322"/>
</Customer>
</AR-Message-Customer>I'm currently using the below Query but it's not helpful in terms of perfomance.
select id,extractValue(value(line),'/Invoice-Lines/@Amount') line_Amount,
extractValue(value(line),'/Invoice-Lines/@Amount-Includes-Tax-FLag') Amount_Includes_Tax_FLag,
extractValue(value(line),'/Invoice-Lines/@Currency-Code') Currency_Code,
extractValue(value(line),'/Invoice-Lines/@Document-Number') Document_Number,
extractValue(value(line),'/Invoice-Lines/@Invoice-Number') Invoice_Number,
extractValue(value(line),'/Invoice-Lines/@Invoice-Date') Invoice_Date,
extractValue(value(line),'/Invoice-Lines/@Line-Number') Line_Number,
extractValue(value(line),'/Invoice-Lines/@Line-Type') Line_Type,
extractValue(value(line),'/Invoice-Lines/@Link-To-Line-Attribute1') Link_To_Line_Attribute1,
extractValue(value(line),'/Invoice-Lines/@Org-Id') Org_Id,
extractValue(value(line),'/Invoice-Lines/@Tax-Code') Tax_Code,
extractValue(value(line),'/Invoice-Lines/@Tax-Excempt-Flag') Tax_Excempt_Flag,
extractValue(value(line),'/Invoice-Lines/@Tax-Excempt-Number') Tax_Excempt_Number,
extractValue(value(line),'/Invoice-Lines/@Tax-Excempt-Reason-Code') Tax_Excempt_Reason_Code,
extractValue(value(line),'/Invoice-Lines/@Tax-Rate') Tax_Rate,
extractValue(value(line),'/Invoice-Lines/@Payment-Method') Payment_Method,
extractValue(value(line),'/Invoice-Lines/@Company') Company,
extractValue(value(line),'/Invoice-Lines/@R-Company') R_Company,
extractValue(value(line),'/Invoice-Lines/@Joint-Venture') Joint_Venture,
extractValue(value(line),'/Invoice-Lines/@R-Joint-Venture') R_Joint_Venture,
extractValue(value(line),'/Invoice-Lines/@Contract') Contract,
extractValue(value(line),'/Invoice-Lines/@R-Contrac') R_Contrac,
extractValue(value(line),'/Invoice-Lines/@R-Dealer') R_Dealer,
extractValue(value(line),'/Invoice-Lines/@Cost-Centre') Cost_Centre,
extractValue(value(line),'/Invoice-Lines/@R-Cost-Centre') R_Cost_Centre,
extractValue(value(line),'/Invoice-Lines/@Account-Code') Account_Code,
extractValue(value(line),'/Invoice-Lines/@R-Account-Code') R_Account_Code,
extractValue(value(line),'/Invoice-Lines/@Supplier') Supplier,
extractValue(value(line),'/Invoice-Lines/@Dealer') Dealer,
extractValue(value(line),'/Invoice-Lines/@Create-Invoice-Flag') Create_Invoice_Flag,
extractValue(value(line),'/Invoice-Lines/@R-Supplier') R_Supplier
from XXWSF_AR_INTEGRATION_LOG a,
table(XMLSequence(extract(xmltype(input_message),'/AR-Message-Customer/Customer/Invoice-Lines'))) line
where id = 4123;Thanks
Lethu
I'm currently using the below Query but it's not helpful in terms of perfomance.How do you measure "performance"? Response time? System resources used?
What performance are you expecting vs. what you're currently observing?
If you're always accessing the table through its unique index, there shouldn't be any performance issue in accessing the table.
Is the XML you posted a typical document you have in the table? In terms of size?
Parsing a document that small shouldn't be an issue either whatever the method used.
Anyway, as Alex said, an optimal storage model would use an XMLType column (binary XML or schema-based object-relational model) instead of CLOB.
Similar Messages
-
Querying Dates missing in the table
I have columns name, taskname start_date and end_date in my table.
e.g.,
Name Task StartDate EndDate
abc task1 2008-04-01 2008-04-03
abc task2 2008-04-05 2008-04-15
abc task3 2008-04-08 2008-04-18
abc task4 2008-04-21 2008-04-25
abc task5 2008-04-19 2008-04-23
abc task6 2008-04-25 2008-04-30
I need to find out the dates for which there are no tasks planned for the person in the month excluding Saturdays and Sundays.
Is it possible to get the output in a single SQL itself, or else how could it be done in PL/SQL procedure ?Hi,
You'll need to do an outer join to a table (or subquery) that has all the possible dates. Here's one example from this site:
OUTER JOIN -
How can I query data from XML file stored as a CLOB ?
Hi folks,
please see below sample of XML file, which is stored in "os_import_docs", column "document" as CLOB.
I would like to query this XML file using some SQL select.
How can I query data form below XML?
<?xml version="1.0" encoding="UTF-8"?>
<etd>
<header>
<AR>000000000</AR>
<AW>0</AW>
<CT>S</CT>
<CU>H</CU>
<CZ>SS48</CZ>
<BU>4</BU>
<CH>0032</CH>
<CK>2012-11-01</CK>
<CL>21:18</CL>
<CW>225</CW>
<CX>0</CX>
<CF>SS-CZL18</CF>
<DV>2</DV>
</header>
<account_group id="234">
<account id="234">
<invoice id="000742024">
<da>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>A</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>88754515</BS>
<AD>Mike Tyson</AD>
<AC>Mike Tyson</AC>
<AZ>CZ6521232465</AZ>
<AE/>
<CG>A</CG>
<AL>A</AL>
<BZ>.</BZ>
<AH>Some street</AH>
<AI/>
<AF>Some city</AF>
<AK>Kraj</AK>
<AG>CZ</AG>
<AJ>885 21</AJ>
<CR>21-11-2012</CR>
<AY>602718709</AY>
<AV>800184965</AV>
<AP/>
<AO/>
<AQ/>
<AN/>
</da>
<da>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>A</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>88754515</BS>
<AD>Mike Tyson</AD>
<AC>Mike Tyson</AC>
<AZ>CZ6521232465</AZ>
<AE/>
<CG>A</CG>
<AL>L</AL>
<BZ>Mike Tyson</BZ>
<AH>Some street</AH>
<AI/>
<AF>Some city</AF>
<AK>Kraj</AK>
<AG>CZ</AG>
<AJ>885 21</AJ>
<CR>21-11-2012</CR>
<AY/>
<AV>800184965</AV>
<AP/>
<AO/>
<AQ/>
<AN/>
</da>
<detaildc CH="0032" AB="234" BS="11888954" BB="32" BA="CZ" AT="" CI="7077329000002340342" AU="" DU="1Z48395" CB="CZK">
<dc>
<AW>0</AW>
<CT>D</CT>
<CU>C</CU>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<CV>8151</CV>
<BT>12111</BT>
<CJ>1</CJ>
<AM>0</AM>
<DR>PC</DR>
<DS/>
<DO>25-10-2012</DO>
<DQ>18:42</DQ>
<CE>1</CE>
<BH>8151</BH>
<CY>8151 SHELL MALKOVICE P</CY>
<DP>049336</DP>
<DT/>
<BQ/>
<BR>500000</BR>
<CN>30</CN>
<CM>030</CM>
<BO>160,00</BO>
<BF>38,900</BF>
<BC>6224,00</BC>
<BI>32,417</BI>
<CD>B</CD>
<BG>0,600</BG>
<BK>31,817</BK>
<BJ>0,000</BJ>
<DI>8</DI>
<BP>20,00%</BP>
<CC>CZK</CC>
<BM>5090,67</BM>
<BN>1018,13</BN>
<BL>6108,80</BL>
<BD>5090,67</BD>
<BE>1018,13</BE>
<DW>6108,80</DW>
<CO>Nafta</CO>
</dc>
</detaildc>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>1</DG>
<CN>30</CN>
<CM>030</CM>
<DF>160,00</DF>
<DH>litr</DH>
<DJ>20,00%</DJ>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA>P</DA>
<AX/>
<CQ/>
<CP/>
</dt>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>2</DG>
<CN/>
<CM/>
<DF>160,00</DF>
<DH>litr</DH>
<DJ/>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA/>
<AX/>
<CQ/>
<CP/>
</dt>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>19</DG>
<CN/>
<CM/>
<DF/>
<DH/>
<DJ/>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA/>
<AX/>
<CQ/>
<CP/>
</dt>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>8</DG>
<CN/>
<CM/>
<DF/>
<DH/>
<DJ/>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA/>
<AX/>
<CQ/>
<CP/>
</dt>
</invoice>
</account>
</account_group>
<footer>
<AR>999999999</AR>
<AW>0</AW>
<CT>S</CT>
<CU>T</CU>
<CZ>SS48</CZ>
<BU>4</BU>
<CH>0032</CH>
<CK>2012-11-01</CK>
<CL>23:04</CL>
<CW>225</CW>
<BX>1</BX>
<CS>7</CS>
<BW>0000000000000610880</BW>
</footer>
</etd>sample - not working:
select x.*
from os_import_docs d
,XMLTABLE('/etd/header'
PASSING httpuritype(d.document).getXML()
COLUMNS
response_status varchar2(50) PATH 'AR'
) x
where d.object_id = 2587058
and rownum = 1;
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 6196, maximum: 4000)Many thanks,
TomasHello,
many thanks for the reply. Your examples are very usefull for me.
To answer your questions.
An XML structure:
/etd
/header - repeat in each row in output
/account_group/account
/invoice
/da - repeat for each details under "selected "invoice
/detaildc/dc - the lowest level
/detaildn/dn - the lowest level
/dt - repeat for each details under "selected "invoice
/footer - repeat in each row in outputI would like to to have a 1 row for each "record" in /detaildc section and include related nodes at higher levels.
Please see below XML file, which is simplified file of example in first post, but includes a complete xml structure which needs to be queried in db.
<?xml version="1.0" encoding="UTF-8"?>
<etd>
<header>
<AR>000000000</AR>
<CK>2012-10-31</CK>
<CF>SS-CZL19</CF>
</header>
<account_group id="234">
<account id="234">
<invoice id="EI08P4000">
<da>
<AR>EI08P4000</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildc DU="1Z56655" CB="EUR">
<dc>
<DO>16-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>1940,60</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="2Z55050" CB="EUR">
<dc>
<DO>17-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>1328,10</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="2Z90001" CB="EUR">
<dc>
<DO>27-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>185,10</BM>
<CO>Poplatek</CO>
</dc>
</detaildc>
<dt>
<AR>EI08P4000</AR>
<DG>8</DG>
</dt>
</invoice>
</account>
<account id="234">
<invoice id="EI13T7777">
<da>
<AR>EI13T7777</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildc DU="1Z48302" CB="EUR">
<dc>
<DO>26-10-2012</DO>
<CY>SANEF 07706 A 07704</CY>
<BM>232,10</BM>
<CO>Dalnicni poplatek</CO>
</dc>
</detaildc>
<detaildc DU="1Z48302" CB="EUR">
<dc>
<DO>20-10-2012</DO>
<CY>TEST A 07704</CY>
<BM>30,10</BM>
<CO>Poplatek</CO>
</dc>
</detaildc>
<dt>
<AR>EI13T7777</AR>
<DG>8</DG>
</dt>
</invoice>
</account>
<account id="234">
<invoice id="EI327744">
<da>
<AR>EI327744</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildn CI="707732 00000234" >
<dn>
<BY>30-10-2012</BY>
<BM>8,10</BM>
</dn>
</detaildn>
<detaildn CI="707732 00000234" >
<dn>
<BY>30-10-2012</BY>
<BM>399,50</BM>
</dn>
</detaildn>
<dt>
<AR>EI327744</AR>
</dt>
</invoice>
</account>
<account id="234">
<invoice id="EI349515">
<da>
<AR>EI349515</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildc DU="1Z56514" CB="EUR">
<dc>
<DO>29-10-2012</DO>
<CY>ALLAMI AUTOPALYAKEZE</CY>
<BM>1240,60</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="1Z56515" CB="EUR">
<dc>
<DO>19-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>7428,10</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="1Z56515" CB="EUR">
<dc>
<DO>12-10-2012</DO>
<CY>UK</CY>
<BM>954,10</BM>
<CO>Poplatek</CO>
</dc>
</detaildc>
<dt>
<AR>EI349515</AR>
<DG>8</DG>
</dt>
</invoice>
</account>
</account_group>
<footer>
<CZ>SS47</CZ>
<BU>4</BU>
<CH>0032</CH>
<CK>2012-10-31</CK>
<CL>01:25</CL>
</footer>
</etd>Expected output
AR CK CF AR4 AD DU CB DO CY BM CO AR5 DG CI BY BM6 CZ BU CH CK7 CL
0 41213 SS-CZL19 EI08P4000 Mickey Mouse 1Z56655 EUR 16-10-2012 ASFINAG POST_MAUT 1940,60 Dalnicni znamka EI08P4000 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI08P4000 Mickey Mouse 2Z55050 EUR 17-10-2012 ASFINAG POST_MAUT 1328,10 Dalnicni znamka EI08P4000 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI08P4000 Mickey Mouse 2Z90001 EUR 27-10-2012 ASFINAG POST_MAUT 185,10 Poplatek EI08P4000 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI13T7777 Mickey Mouse 1Z48302 EUR 26-10-2012 SANEF 07706 A 07704 232,10 Dalnicni poplatek EI13T7777 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI13T7777 Mickey Mouse 1Z48302 EUR 20-10-2012 TEST A 07704 30,10 Poplatek EI13T7777 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI327744 Mickey Mouse EI327744 707732 00000234 30-10-2012 8,10 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI327744 Mickey Mouse EI327744 707732 00000234 30-10-2012 399,50 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI349515 Mickey Mouse 1Z56514 EUR 29-10-2012 ALLAMI AUTOPALYAKEZE 1240,60 Dalnicni znamka EI349515 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI349515 Mickey Mouse 1Z56515 EUR 19-10-2012 ASFINAG POST_MAUT 7428,10 Dalnicni znamka EI349515 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI349515 Mickey Mouse 1Z56515 EUR 12-10-2012 UK 954,10 Poplatek EI349515 8 SS47 4 32 41213 01:25 -
Date insertion from large XML document (clob) into relation table very slow
Hi Everybody!
I'm working with Oracle 9.2.0.5 on Microsoft Windows Server 2003 Enterprise Edition.
The server (a test server) is a Pentium 4 2.8 GHz, 1GB of RAM.
I use a procedure called PARITOP_TRAITERXMLRESULTMASSE to insert the data contained in the pXMLDOC clob parameter in the table pTABLENAME. (You can see the format of the XML document below). The first step on this procedure is to verify that the XML document is not empty. If not, the procedure needs to add a node in the document, in every <ROW> tag. This added node is named âRST_IDâ. Itâs the foreign key of each record. I can retrieve the value of each <RST_ID> node in an other table in which the data has been previously added (by the calling procedure). When each of the <ROW> elements has been treated, the PARITOP_INSERTXML procedure is called. This procedure uses DBMS_XMLSAVE.INSERTXML to insert the data contained in the XML document in the specified table.
(Below, you can see the code of my procedures.)
With this information, can you tell me why this treatment is very very very slow with a large XML document and how I can improve it?
Thank you for your help!
Anne-Marie
CREATE OR REPLACE PROCEDURE "PARITOP_TRAITERXMLRESULTMASSE" (
pPRC_ID IN PARITOP_PARC.PRC_ID%TYPE,
pRST_MONDE IN PARITOP_RESULTAT.RST_MONDE%TYPE,
pXMLDOC IN CLOB,
pTABLENAME IN VARCHAR2)
AS
Objectif :Insérer le contenu du XML passé en paramètre (pXMLDOC) à la table passée en paramètre (pTABLENAME)
La table passée en paramètre doit être une table ayant comme clé étrangère le champs "RST_ID" .
(Le noeud RST_ID est donc ajouté à tous les document XML. Ce rst_id est
déterminé à partir de la table PARITOP_RESULTAT grâce à pPRC_ID et
pRstMonde fournis en paramètre)
result_doc CLOB;
XMLDOMDOC XDB.DBMS_XMLDOM.DOMDOCUMENT;
NODE_ROWSET DBMS_XMLDOM.DOMNODE;
NODE_ROW DBMS_XMLDOM.DOMNODE;
vUE_ID PARITOP_RESULTAT.UE_ID%TYPE;
vRST_ID PARITOP_RESULTAT.RST_ID%TYPE;
nodeList DBMS_XMLDOM.DOMNODELIST;
BEGIN
BEGIN
vUE_ID := 0;
vRST_ID := 0;
XMLDOMDOC := DBMS_XMLDOM.NEWDOMDOCUMENT(pXMLDOC);
IF NOT GESTXML_PKG.FN_PARITOP_DOCUMENT_IS_NULL(XMLDOMDOC) THEN
NODE_ROWSET := DBMS_XMLDOM.item(DBMS_XMLDOM.GETCHILDNODES (DBMS_XMLDOM.MAKENODE(XMLDOMDOC)),0);
for i in 0..dbms_xmldom.getLength(DBMS_XMLDOM.getchildnodes(NODE_ROWSET))-1 loop
NODE_ROW := DBMS_XMLDOM.ITEM(DBMS_XMLDOM.GETCHILDNODES(NODE_ROWSET), i) ;
nodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(DBMS_XMLDOM.makeelement(NODE_ROW) , 'UE_ID');
IF vUE_ID <> DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0))) THEN
vUE_ID := DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0)));
--on ramasse le rst_id
SELECT RST_ID INTO vRST_ID
FROM PARITOP_RESULTAT RST
WHERE RST.PRC_ID = pPRC_ID
AND RST.UE_ID = vUE_ID
AND RST.RST_MONDE = pRST_MONDE
AND RST_A_SUPPRIMER = 0;
END IF;
GESTXML_PKG.PARITOP_ADDNODETOROW(XMLDOMDOC, NODE_ROW, 'RST_ID', vRST_ID);
end loop;
RESULT_DOC := ' '; --Ã garder, pour ne pas que ca fasse d'erreur lors du WriteToClob.
dbms_xmldom.writeToClob(DBMS_XMLDOM.MAKENODE(XMLDOMDOC), RESULT_DOC);
--Insertion du document XML dans la table "tableName"
GESTXML_PKG.PARITOP_INSERTXML(RESULT_DOC, pTABLENAME);
DBMS_XMLDOM.FREEDOCUMENT( XMLDOMDOC);
end if;
EXCEPTION
[â¦exception treatementâ¦]
END;
END;
The format of a XML clob is :
<ROWSET>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6223</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>92.307692307692307</CMP_INDICESELECTION>
<CMP_PVRES>94900</CMP_PVRES>
<CMP_PVAJUSTE>72678.017699115066</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>72678.017699115095</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>72678.017699115037</CMP_PVAJUSTEMAX>
<CMP_PV>148000</CMP_PV>
<CMP_VALROLE>129400</CMP_VALROLE>
<CMP_PVRESECART>4790</CMP_PVRESECART>
<CMP_PVRHAB>101778.01769911509</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>148000</CMP_PVA>
</ROW>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6235</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>76.92307692307692</CMP_INDICESELECTION>
<CMP_PVRES>117800</CMP_PVRES>
<CMP_PVAJUSTE>118080</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>118080</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>118080</CMP_PVAJUSTEMAX>
<CMP_PV>172000</CMP_PV>
<CMP_VALROLE>134800</CMP_VALROLE>
<CMP_PVRESECART>0</CMP_PVRESECART>
<CMP_PVRHAB>147180</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>172000</CMP_PVA>
</ROW>
</ROWSET>
PARITOP_COMPARABLE TABLE :
RST_ID NUMBER(10) NOT NULL,
VEN_ID NUMBER(10) NOT NULL,
CMP_SELMAN NUMBER(1) NOT NULL,
CMP_UTILISE NUMBER(1) NOT NULL,
CMP_INDICESELECTION FLOAT(53) NOT NULL,
CMP_PVRES FLOAT(53) NULL,
CMP_PVAJUSTE FLOAT(53) NULL,
CMP_PVRHAB FLOAT(53) NULL,
CMP_TVM FLOAT(53) NULL
ROCEDURE PARITOP_INSERTXML (xmlDoc IN clob, tableName IN VARCHAR2)
AS
insCtx DBMS_XMLSave.ctxType;
rowss number;
BEGIN
--permet d'insérer les champs du XML dans la table passée en paramètre.
--il suffit que les champs XML aient le même nom que les champs de la table
BEGIN
insCtx := DBMS_XMLSave.newContext(tableName); -- get context handle
DBMS_XMLSAVE.SETDATEFORMAT( insCtx, 'yyyy-MM-dd HH:mm:ss');--attention, case sensitive
DBMS_XMLSAVE.setIgnoreCase(insCtx, 1);
rowss := DBMS_XMLSAVE.INSERTXML(insCtx , xmlDoc);
DBMS_XMLSave.closeContext(insCtx);
EXCEPTION
[â¦]
END;
END;
PROCEDURE PARITOP_ADDNODETOROW (
XMLDOMDOC DBMS_XMLDOM.DOMDOCUMENT,
NODE_ROW dbms_xmldom.DOMNode,
NOM_NOEUD VARCHAR2,
VALEUR_NOEUD VARCHAR2)
AS
--PERMET D'AJOUTER UN NOEUD AVEC 1 SEULE VALEUR DANS une ROW D'UN XML.
--UTILE SURTOUT POUR LES CLÃS ÃTRANGÃRES
domElemAInserer DBMS_XMLDOM.DOMELEMENT;
NODE dbms_xmldom.DOMNode;
NODE_TMP dbms_xmldom.DOMNode;
BEGIN
domElemAInserer := DBMS_XMLDOM.createElement(XMLDOMDOC, NOM_NOEUD) ;
NODE := DBMS_XMLDOM.MAKENODE(domElemAInserer); --cast
NODE := DBMS_XMLDOM.APPENDCHILD(NODE_ROW,NODE);
NODE_TMP := DBMS_XMLDOM.MAKENODE(DBMS_XMLDOM.CREATETEXTNODE(XMLDOMDOC, VALEUR_NOEUD ) );
NODE := DBMS_XMLDOM.APPENDCHILD(NODE,NODE_TMP );
END;Hi Everybody!
I'm working with Oracle 9.2.0.5 on Microsoft Windows Server 2003 Enterprise Edition.
The server (a test server) is a Pentium 4 2.8 GHz, 1GB of RAM.
I use a procedure called PARITOP_TRAITERXMLRESULTMASSE to insert the data contained in the pXMLDOC clob parameter in the table pTABLENAME. (You can see the format of the XML document below). The first step on this procedure is to verify that the XML document is not empty. If not, the procedure needs to add a node in the document, in every <ROW> tag. This added node is named âRST_IDâ. Itâs the foreign key of each record. I can retrieve the value of each <RST_ID> node in an other table in which the data has been previously added (by the calling procedure). When each of the <ROW> elements has been treated, the PARITOP_INSERTXML procedure is called. This procedure uses DBMS_XMLSAVE.INSERTXML to insert the data contained in the XML document in the specified table.
(Below, you can see the code of my procedures.)
With this information, can you tell me why this treatment is very very very slow with a large XML document and how I can improve it?
Thank you for your help!
Anne-Marie
CREATE OR REPLACE PROCEDURE "PARITOP_TRAITERXMLRESULTMASSE" (
pPRC_ID IN PARITOP_PARC.PRC_ID%TYPE,
pRST_MONDE IN PARITOP_RESULTAT.RST_MONDE%TYPE,
pXMLDOC IN CLOB,
pTABLENAME IN VARCHAR2)
AS
Objectif :Insérer le contenu du XML passé en paramètre (pXMLDOC) à la table passée en paramètre (pTABLENAME)
La table passée en paramètre doit être une table ayant comme clé étrangère le champs "RST_ID" .
(Le noeud RST_ID est donc ajouté à tous les document XML. Ce rst_id est
déterminé à partir de la table PARITOP_RESULTAT grâce à pPRC_ID et
pRstMonde fournis en paramètre)
result_doc CLOB;
XMLDOMDOC XDB.DBMS_XMLDOM.DOMDOCUMENT;
NODE_ROWSET DBMS_XMLDOM.DOMNODE;
NODE_ROW DBMS_XMLDOM.DOMNODE;
vUE_ID PARITOP_RESULTAT.UE_ID%TYPE;
vRST_ID PARITOP_RESULTAT.RST_ID%TYPE;
nodeList DBMS_XMLDOM.DOMNODELIST;
BEGIN
BEGIN
vUE_ID := 0;
vRST_ID := 0;
XMLDOMDOC := DBMS_XMLDOM.NEWDOMDOCUMENT(pXMLDOC);
IF NOT GESTXML_PKG.FN_PARITOP_DOCUMENT_IS_NULL(XMLDOMDOC) THEN
NODE_ROWSET := DBMS_XMLDOM.item(DBMS_XMLDOM.GETCHILDNODES (DBMS_XMLDOM.MAKENODE(XMLDOMDOC)),0);
for i in 0..dbms_xmldom.getLength(DBMS_XMLDOM.getchildnodes(NODE_ROWSET))-1 loop
NODE_ROW := DBMS_XMLDOM.ITEM(DBMS_XMLDOM.GETCHILDNODES(NODE_ROWSET), i) ;
nodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(DBMS_XMLDOM.makeelement(NODE_ROW) , 'UE_ID');
IF vUE_ID <> DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0))) THEN
vUE_ID := DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0)));
--on ramasse le rst_id
SELECT RST_ID INTO vRST_ID
FROM PARITOP_RESULTAT RST
WHERE RST.PRC_ID = pPRC_ID
AND RST.UE_ID = vUE_ID
AND RST.RST_MONDE = pRST_MONDE
AND RST_A_SUPPRIMER = 0;
END IF;
GESTXML_PKG.PARITOP_ADDNODETOROW(XMLDOMDOC, NODE_ROW, 'RST_ID', vRST_ID);
end loop;
RESULT_DOC := ' '; --Ã garder, pour ne pas que ca fasse d'erreur lors du WriteToClob.
dbms_xmldom.writeToClob(DBMS_XMLDOM.MAKENODE(XMLDOMDOC), RESULT_DOC);
--Insertion du document XML dans la table "tableName"
GESTXML_PKG.PARITOP_INSERTXML(RESULT_DOC, pTABLENAME);
DBMS_XMLDOM.FREEDOCUMENT( XMLDOMDOC);
end if;
EXCEPTION
[â¦exception treatementâ¦]
END;
END;
The format of a XML clob is :
<ROWSET>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6223</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>92.307692307692307</CMP_INDICESELECTION>
<CMP_PVRES>94900</CMP_PVRES>
<CMP_PVAJUSTE>72678.017699115066</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>72678.017699115095</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>72678.017699115037</CMP_PVAJUSTEMAX>
<CMP_PV>148000</CMP_PV>
<CMP_VALROLE>129400</CMP_VALROLE>
<CMP_PVRESECART>4790</CMP_PVRESECART>
<CMP_PVRHAB>101778.01769911509</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>148000</CMP_PVA>
</ROW>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6235</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>76.92307692307692</CMP_INDICESELECTION>
<CMP_PVRES>117800</CMP_PVRES>
<CMP_PVAJUSTE>118080</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>118080</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>118080</CMP_PVAJUSTEMAX>
<CMP_PV>172000</CMP_PV>
<CMP_VALROLE>134800</CMP_VALROLE>
<CMP_PVRESECART>0</CMP_PVRESECART>
<CMP_PVRHAB>147180</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>172000</CMP_PVA>
</ROW>
</ROWSET>
PARITOP_COMPARABLE TABLE :
RST_ID NUMBER(10) NOT NULL,
VEN_ID NUMBER(10) NOT NULL,
CMP_SELMAN NUMBER(1) NOT NULL,
CMP_UTILISE NUMBER(1) NOT NULL,
CMP_INDICESELECTION FLOAT(53) NOT NULL,
CMP_PVRES FLOAT(53) NULL,
CMP_PVAJUSTE FLOAT(53) NULL,
CMP_PVRHAB FLOAT(53) NULL,
CMP_TVM FLOAT(53) NULL
ROCEDURE PARITOP_INSERTXML (xmlDoc IN clob, tableName IN VARCHAR2)
AS
insCtx DBMS_XMLSave.ctxType;
rowss number;
BEGIN
--permet d'insérer les champs du XML dans la table passée en paramètre.
--il suffit que les champs XML aient le même nom que les champs de la table
BEGIN
insCtx := DBMS_XMLSave.newContext(tableName); -- get context handle
DBMS_XMLSAVE.SETDATEFORMAT( insCtx, 'yyyy-MM-dd HH:mm:ss');--attention, case sensitive
DBMS_XMLSAVE.setIgnoreCase(insCtx, 1);
rowss := DBMS_XMLSAVE.INSERTXML(insCtx , xmlDoc);
DBMS_XMLSave.closeContext(insCtx);
EXCEPTION
[â¦]
END;
END;
PROCEDURE PARITOP_ADDNODETOROW (
XMLDOMDOC DBMS_XMLDOM.DOMDOCUMENT,
NODE_ROW dbms_xmldom.DOMNode,
NOM_NOEUD VARCHAR2,
VALEUR_NOEUD VARCHAR2)
AS
--PERMET D'AJOUTER UN NOEUD AVEC 1 SEULE VALEUR DANS une ROW D'UN XML.
--UTILE SURTOUT POUR LES CLÃS ÃTRANGÃRES
domElemAInserer DBMS_XMLDOM.DOMELEMENT;
NODE dbms_xmldom.DOMNode;
NODE_TMP dbms_xmldom.DOMNode;
BEGIN
domElemAInserer := DBMS_XMLDOM.createElement(XMLDOMDOC, NOM_NOEUD) ;
NODE := DBMS_XMLDOM.MAKENODE(domElemAInserer); --cast
NODE := DBMS_XMLDOM.APPENDCHILD(NODE_ROW,NODE);
NODE_TMP := DBMS_XMLDOM.MAKENODE(DBMS_XMLDOM.CREATETEXTNODE(XMLDOMDOC, VALEUR_NOEUD ) );
NODE := DBMS_XMLDOM.APPENDCHILD(NODE,NODE_TMP );
END; -
How to Insert data from an XML file into an Oracle 10g table
Hello,
Please can you help me as I have hit a brick wall with this problem.
We are running version 10g Oracle and we will start receiving XML files with employee data that needs loading into a table, this is the XML file:
<?xml version="1.0"?>
<RECRUITS>
<RECRUIT>
<FIRST_NAME>Gordon</FIRST_NAME>
<LAST_NAME>Brown</LAST_NAME>
<SHORT_NAME>GORDONBROWN</SHORT_NAME>
<APP_NO>00002</APP_NO>
<STATUS>M</STATUS>
<DATE_FROM>21-JUL-2006</DATE_FROM>
<RESOURCE_TYPE>P</RESOURCE_TYPE>
<TITLE>Mr</TITLE>
<DATE_OF_BIRTH>28-DEC-1983</DATE_OF_BIRTH>
<SOCIAL_SEC>AB128456A</SOCIAL_SEC>
<PARTTIME_PCT>1</PARTTIME_PCT>
<SEX>M</SEX>
<ADDRESS_TYPE>1</ADDRESS_TYPE>
<ADDRESS>A HOUSE SOMEWHERE HERE</ADDRESS>
<ZIP_CODE>PE3 LLL</ZIP_CODE>
<PLACE>BOROUGH</PLACE>
<COUNTRY_CODE>UK</COUNTRY_CODE>
<PROVINCE>UK</PROVINCE>
<EMAIL>[email protected]</EMAIL>
</RECRUIT>
(FYI - there may be more than 1 employee in each file so all of the above will be repeated X amount of times)
</RECRUITS>
To make things simple we have created a table which mirrors the XML file completely to load the data into, the SQL i have used is thus:
CREATE TABLE RECRUITMENT
FIRST_NAME VARCHAR2(30),
LAST_NAME VARCHAR2(30),
SHORT_NAME VARCHAR2(30),
APP_NO NUMBER,
STATUS VARCHAR2(1),
DATE_FROM DATE,
RESOURCE_TYPE VARCHAR2(1),
TITLE VARCHAR2(4),
DATE_OF_BIRTH DATE,
SOCIAL_SEC VARCHAR2(9),
PARTTIME_PCT NUMBER,
SEX VARCHAR2(1),
ADDRESS_TYPE VARCHAR2(1),
ADDRESS VARCHAR2(30),
ZIP_CODE VARCHAR2(8),
PLACE VARCHAR2(10),
PROVINCE VARCHAR2(3),
EMAIL VARCHAR2(20)
Every method we try from the numerous documents and so called "user guides" have failed, please can somebody show me the PL/SQL i need to get this files data into the above table?
We need to be able to do this purely through SQL*PLUS as we hope - if we ever get it working manually to create a procuedure that will encapsulate everything so it can be run over and over again.
The XML file is sitting in the XMLDIR and is called REC.XML.
Please help : (Hi, I have got some material for inserting data into oracle table from xml file, this might help you.
Create XML Document Table
create table XML_DOCUMENT_TABLE
FILENAME varchar2(64),
XML_DOCUMENT XMLTYPE
(This will be as per your record details).
Inserting record to Oracle Table
declare
XML_TEXT CLOB := '<smsnotification>
<messageid> 256427844 </messageid>
<protocolid> CO0NPS2KHQ </protocolid>
<notifiedon> 1156123007416 </notifiedon>
<status> 3PBI: Invalid </status>
<additionalinfo> Customer account not active </additionalinfo>
<carrierid> 1175 </carrierid>
</smsnotification>';
begin
insert into XML_DOCUMENT_TABLE values ('Receipt.xml',XMLTYPE(XML_TEXT));
end;
Select Statement
select extractValue(XML_DOCUMENT,'/smsnotification/messageid') Messageid,
extractValue(XML_DOCUMENT,'/smsnotification/status') Status,
extractValue(XML_DOCUMENT,'/smsnotification/carrierid') CarrierID
from XML_DOCUMENT_TABLE; -
Putting XML data in Oracle 8i tables.
Hi,
For a ongoing project, I have to put XML data in Oracle
tables. I have to parse the XMl and extract few key items and
the rest of the XML is to put into CLOB column. I am looking to
use Event-based parser.
I was trying to use Oracle XML parser for PL/SQL. This parser
does not have SAX support curently. Does anbody know by when
this parser support SAX? It has already been promised as one of
the feature.
Can somebody suggest using some other parser? Can I use some
parser which can be integrated within Oracle so that I wont have
to use ODBC etc. for accessing tables.
Has somebody used Oracle XMl parser for Java ? Does parser
integrate within Oracle. How can we go about the procs of
parsing and putting results in oracle tables.
Looking forward to quick response,
Premal.
nullThere is no announced date for the addition of the SAX interface
to the PL/SQL Parser yet. Your current option is to use the XML
SQL Utility for Java to interchange XML data.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
Premal Mehta (guest) wrote:
: Hi,
: For a ongoing project, I have to put XML data in Oracle
: tables. I have to parse the XMl and extract few key items and
: the rest of the XML is to put into CLOB column. I am looking
to
: use Event-based parser.
: I was trying to use Oracle XML parser for PL/SQL. This
parser
: does not have SAX support curently. Does anbody know by when
: this parser support SAX? It has already been promised as one
of
: the feature.
: Can somebody suggest using some other parser? Can I use
some
: parser which can be integrated within Oracle so that I wont
have
: to use ODBC etc. for accessing tables.
: Has somebody used Oracle XMl parser for Java ? Does parser
: integrate within Oracle. How can we go about the procs of
: parsing and putting results in oracle tables.
: Looking forward to quick response,
: Premal.
null -
How to query from the xml table a single, specified element.
I'm quite new in Xml Db. Pleas, can anybody tell me how to query from the xml table below a single element (i.e. the element 'rapportoparentela = NIPOTE' related to the element 'codicefiscale = CRRVNC76R52G337R', or the element 'rapportoparentela = FIGLIO' related to the element 'codicefiscale = CRRRNT51L23G337Q')?
- <dati xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<codiceinterno />
<codicefiscaleassistito>CRRMNL81R31G337H</codicefiscaleassistito>
- <famigliare>
<codicefiscale>CRRVNC76R52G337R</codicefiscale>
<rapportoparentela>NIPOTE</rapportoparentela>
</famigliare>
- <famigliare>
<codicefiscale>CRRRNT51L23G337Q</codicefiscale>
<rapportoparentela>FIGLIO</rapportoparentela>
</famigliare>
- <famigliare>
<codicefiscale>CBRPRN15S65E080W</codicefiscale>
<rapportoparentela>I.S.</rapportoparentela>
</famigliare>
- <famigliare>
<codicefiscale>CRRMNL81R31G337H</codicefiscale>
<rapportoparentela>NIPOTE</rapportoparentela>
</famigliare>
- <famigliare>
<codicefiscale>BCCCML54C50I845G</codicefiscale>
<rapportoparentela>NUORA</rapportoparentela>
</famigliare>
</dati>
Using SELECT extractValue(value(t),'/rapportoparentela') into result FROM NF_XMLT X,
TABLE ( xmlsequence (extract(value(X),'/dati/famigliare/rapportoparentela'))) t
I get all the elements 'rapportoparentela' and I want to get only one specified.
Regards.
PieroPiero,
you can add the condition "CRRVNC76R52G337R" to your xpath-expression like:
SELECT extractValue(value(t),'/rapportoparentela')
FROM NF_XMLT x
,TABLE ( xmlsequence (extract(value(X),'/dati/famigliare[rapportoparentela="CRRVNC76R52G337R"]'))) tto select only those famigliare-elements that have a child-element rapportoparentela with value "CRRVNC76R52G337R".
When you stored your XML in an XMLType column in the table, i think the following queries are better:
SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
FROM NF_XMLT x
WHERE extractValue(x.your_XMLType_column,'/dati/famigliare/codicefiscale')
= 'CRRVNC76R52G337R'or
SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
FROM NF_XMLT x
WHERE existsNode(x.your_XMLType_column,'/dati/famigliare[codicefiscale="CRRVNC76R52G337R"]')
!= 0 -
Hello,
Please, help me.
I am depending on this query working fine to complete a academic task.
On the Oracle xml database Express version 11.2.0.2.0 I used data from wikipedia to populate my table of XML files and W3C use case as a query model (XQuery and XPath Full Text 1.0 Use Cases).
I have a table with 26.416 split xml files into some xml columns, it is about 512 MB.
CREATE TABLE tb_wikipedia_inex (DOC VARCHAR(30) NOT NULL,
XML XMLTYPE,
PRIMARY KEY (DOC)
I want to perform a query (full text) on all those files but when I execute a xquery it retuns nothing or warnings. Unfortunatelly I understand nothing from trace file.
SQLPLUS:
XQUERY fn:collection("oradb:/HR/TB_INEX2009")//article//language [ora:contains(., "java") > 0]
TRACE FILE:
System altered.
Elapsed: 00:00:42.08
Session altered.
Elapsed: 00:00:00.00
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
Elapsed: 00:00:00.05
Execution Plan
Plan hash value: 1500681423
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
Time |
| 0 | SELECT STATEMENT | | 8168 | 16336 | 29 (0)|
00:00:01 |
| 1 | COLLECTION ITERATOR XMLSEQ FETCH | XMLSEQUENCEFROMXMLTYPE | 8168 | 16336 | 29 (0)|
00:00:01 |
| 2 | SORT AGGREGATE | | 1 | 2 | |
|
|* 3 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | 408 | 816 | 66 (57)|
00:00:01 |
Predicate Information (identified by operation id):
3 - filter(SYS_XMLCONTAINS(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(SYS_XQCON2SEQ(VALUE(KOKBF$
,'/language/text()'),1,50),50,1,0),'java')>0)
Note
- Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
How can I execute xquery over a bunch of xml files to obtain xml data?
Regards,
DaianeHello,
I was trying to find what is the problem, but without success.
The most simple test don't work.
So, I created a new table with few xml files to reproduce the query.
Below are my scripts:
XML COLUMN SQLPLUS
CREATE TABLE HR.tb_xml (DOC VARCHAR(30) NOT NULL,
XML XMLTYPE,PRIMARY KEY (DOC))
CREATE INDEX HR.Ixml_tb_xml ON HR.tb_xml (XML) INDEXTYPE IS XDB.XMLINDEX PARAMETERS ('PATHS (INCLUDE(//article
//article/physical_entity/communicator/person/compiler/causal_agent/language))')
CREATE INDEX Itxt_tb_xml1 ON HR.tb_xml (XML) INDEXTYPE IS CTXSYS.CONTEXT;
Shell:
nohup sqlldr daiane/daiane DIRECT=false PARALLEL=false control = load_xml.ctl;
XML TABLE SQLPLUS:
create table livros of XMLTYPE;
Shell:
nohup sqlldr daiane/daiane DIRECT=false PARALLEL=false control = load_xmltb.ctl;
XML Files:
https://www.dropbox.com/sh/sn26jq6fjoi4635/0wjJI6tT4h
Queries:
for XQUERY fn:collection("oradb:/HR/TB_XML")//article/physical_entity/communicator/person/compiler/causal_agent/language/writer/header/categories/category [ora:contains(., "PHP") > 0]
XQUERY fn:collection("oradb:/HR/TB_XML")//article/physical_entity/communicator/person/compiler/causal_agent/language/writer/header/title [ora:contains(text(), "PHP") > 0]
for XQUERY fn:collection("oradb:/HR/LIVROS")//article/physical_entity/communicator/person/compiler/causal_agent/language/writer/header/categories/category [ora:contains(., "PHP") > 0]
XQUERY fn:collection("oradb:/HR/LIVROS")//article/physical_entity/communicator/person/compiler/causal_agent/language/writer/header/title [ora:contains(text(), "PHP") > 0]
What is wrong with these queries?
Regards,
Daiane -
When / why use XML to store data instead of database table ?
Hi All,
I still not use XML much in applications and don't know much about its utilization.
I read here and there about storing data as XML instead of into database tables.
- could any body please tell me when / why use XML to store data instead of database table ?
e.g : store inventory per warehouse in XML format. ?
- What is the other cases or reasons of extracting database records into XML or vice versa ?
- is there any good pdf on this ?
Thank you for your help,
xtantoIt depends entirely what you want to accomplish with the 'XML in the database'. There are basically 3 independent methods: As CLOB, as XMLType views or as native XMLType 'columns'
Each method has advantages and disadvantages, especially in the performance vs purpose tradeoff.
The Oracled Press book "Oracle Database 10g XML & SQL Design, Build, & Manage XML Applications in Java, C, C++, & PL/SQL" is highly recommended for anyone interested in Oracle and XML. http://books.mcgraw-hill.com/getbook.php?isbn=0072229527&template=oraclepress -
Help Required -- Can we use SQL Query to READ data from SAP MDM Tables
Hi All,
Please help.........
Can we use SQL Query to READ(No Creation/Updation/Deletion just Read) Data from SAP MDM tables directly, without using MDM Syndicator.
Or direct SQL access to SAP MDM tables is not possible. Only through MDM Syndicator can we export data.
Thanks in Advance
RegardsAll the tables you create in Repository comes under A2i_CM_Tables in Database named as your repository name. So the tables names are fields of table A2i_CM_Tables. Now i tried it but cant make it.
Now, I dont think its possible to extract all fields in tables and there values using select query. May be pure sql guy can do that or not.
But there is no relation of data extraction and syndicator. Data is viewed in Data Manager. and you can also store data in a file from DM also.
BR,
Alok -
HELLO...
I hope you experts out there can help me. Consider the following (2) Tables in MSSQL:
1. TENDERED --> Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
DATE
DOC_NO
PMNT_SEQ_NO
PAYCODE_TYPE
AMOUNT
2. TENDERED_CR_CARD -->Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
DATE
DOC_NO
PMNT_SEQ_NO
CR_CARD_NO_MASKED
CR_CARD_NAME
CR_CARD_EXP_DATE
These two tables are certainly related, based on their Primary Key values.
Now, consider the following data in those two tables:
DATE
DOC_NO PMNT_SEQ_NO
PAYCODE_TYPE
AMOUNT
03/10/2014 100001
1
CASH
100.00
03/10/2014 100001
2
CASH
-9.75
03/10/2014 100002
1
CASH
50.00
03/10/2014 100002
2
VISA
100.00
03/10/2014 100002
3
VISA
250.00
03/10/2014 100003
1
MC
125.00
03/10/2014 100003
2
AMEX
75.00
DATE
DOC_NO PMNT_SEQ_NO CR_CARD_MASKED
NAME
CR_CARD_EXP
03/10/2014 100002 2 4225******801289
MARY JONES 2016/08/31
03/10/2014 100002 3 4121******637442
JOHN DOE 2015/04/30
03/10/2014 100003 1 5428******971134
MIKE BAKER 2018/09/30
03/10/2014 100003 2 3732*****344756
LINDA LIU 2017/07/31
OK...so what we NEED...is a Combined, SINGLE RECORD Audit Report type query.
The resulting query should show, based on the Data from above, the SINGLE LINE represented in the Attached Spreadsheet.
NOTE...what's important to point out here..is that ONLY the 'CASH' Tender gets "summed"...EACH INDIVIDUAL Credit Card record MUST have its own Field...as represented in the corresponding Columns of the Spreadsheet (i.e. PMT_TYP_1, AMT_1, PMT_TYP_2,
AMT_2, and so forth).
PLEASE HELP! Any suggestions/advice would be most appreciated!
Thank You!...MarkI would not do this in SQL if I could possibly avoid it. Instead do it in the front end.
If you must do it in SQL, this is a dynamic pivot on multiple columns. Naomi Nosonovsky has a blog at
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/dynamic-pivot-on-multiple-columns/ on how to do that. Look especially at her second example using the claims table. Of course, you must do some manipulation even before you do the multi-column
pivot, since you must first combine all the cash entries.
So one way to do it would be to build a temp table with all the entries you have except the cash entries combined into one payment sequence number. To do that you may need specifications that are not clear to me from what you have given us. For
example, if PMT SEQ 1 is VISA, PMT SEQ 2 is CASH, PMT SEQ 3 is VISA, PMT SEQ 4 is CASH, and PMT SEQ 5 is VISA, you want to combine the two cash payments. So they become PMT SEQ 2? If so, what happens to PMT SEQ 4 - is it left N/A or does
PMT SEQ 5 become PMT SEQ 4?
But once you have this temp table with the cash payments combined in the algorithm you need, then you can use Naomi's method to do the multi-column pivot. Note that Naomi uses the code
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_Name = 'Claims'
to get the column names from the permanent table Claims. To get the column names from a temp table use code like the following. To find the column names in a temp table named #MyTempTable, do
From tempdb.sys.columns
Where object_id = OBJECT_ID('#MyTempTable')
But as I say, if feasible, I would do this in the front end, not in SQL. T-SQL is a very good language for storing and retrieving data, not so good at formatting it.
Tom -
Select data from an XML Column in a Relational Table
Hi guys,
I read a lot of documentation from Oracle how to select xml nodes from an XML Table. The following statement works perfectly for an XML table.
select extract(OBJECT_VALUE, '/loop/loop_data/description') "DESCRIPTION"
from loop_table
where xmlexists('/loop/loop_data[type_code="212"]' PASSING OBJECT_VALUE);
BUT: how to select xml nodes (data) from a relational table with an XML column???
I'm interested in the xml data.
Thanks!
MiroI've tried the same but i don't get any results
WITH BOL_JMS_MESSAGES_TMP AS
(SELECT 1 pk,
XMLTYPE('<MESSAGE_ENVELOPE>
<ORDER>
<DIRECT_TURNOVER>N</DIRECT_TURNOVER>
<DATE_PLACED>2010-05-06T17:14:35.189+02:00</DATE_PLACED>
<PAYMENT_TYPE>02</PAYMENT_TYPE>
<ACCOUNT_NUMBER>108317412</ACCOUNT_NUMBER>
<GIFT_FLAG>N</GIFT_FLAG>
<ID>7788783900</ID>
<NETPRICE>117.21</NETPRICE>
<VAT>7.69</VAT>
<TOTALPRICE>126.85</TOTALPRICE>
<SHIPHAND_COSTS>1.64</SHIPHAND_COSTS>
<SHIPHAND_VAT>0.31</SHIPHAND_VAT>
<SHIPEQUALBILL_FLAG>Y</SHIPEQUALBILL_FLAG>
<SHIPPING_METHOD>01</SHIPPING_METHOD>
</ORDER>
</MESSAGE_ENVELOPE>') rnd_col
from dual
select extract(rnd_col, '/message_envelope/order/direct_turnover/date_placed/payment_type/account_number/gift_flag/id/netprice/vat/totalprice/shiphand_costs/shiphand_vat/shipequalbill_flag/SHIPPING_METHOD') "Payment type"
FROM BOL_JMS_MESSAGES_TMP
WHERE existsNode(rnd_col,'/message_envelope') = 1;
No rows.
Eventually i want to update the payment type from 02 to 00. -
Xml data to abap internal table
I'm presently working on a interface where data in abap internal table is converted into xml format and placed in the frontend and vice versa.
I'm through with the first part and in secodn part also I'm able to transfer the data from frontend to Document Object Model(DOM) by parsing but finally am not able to put it into an internal table.
Please help (Urgent).
Thanks and regards,
S.K.TripathyHi sitakant,
1. itab --- > xml
xml ---> itab.
2. This program will do both.
(just copy paste in new program)
3.
REPORT abc.
DATA
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
FIRST PHASE
FIRST PHASE
FIRST PHASE
Fetch Data
SELECT * FROM t001 INTO TABLE t001.
XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = itab.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:\xx.xml'
TABLES
data_tab = itab.
SECOND PHASE
SECOND PHASE
SECOND PHASE
BREAK-POINT.
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]
BREAK-POINT.
regards,
amit m. -
Why Isn't xmlindex being used in slow query on binary xml table eval?
I am running a slow simple query on Oracle database server 11.2.0.1 that is not using an xmlindex. Instead, a full table scan against the eval binary xml table occurs. Here is the query:
select -- /*+ NO_XMLINDEX_REWRITE no_parallel(eval)*/
defid from eval,
XMLTable(XMLNAMESPACES(DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03',
'http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7"),
'$doc/eval/derivedFacts/ns7:derivedFact' passing eval.object_value as "doc" columns defid varchar2(100) path 'ns7:defId'
) eval_xml
where eval_xml.defid in ('59543','55208'); The predicate is not selective at all - the returned row count is the same as the table row count (325,550 xml documents in the eval table). When different values are used bringing the row count down to ~ 33%, the xmlindex still isn't used - as would be expected in a purely relational nonXML environment.
My question is why would'nt the xmlindex be used in a fast full scan manner versus a full table scan traversing the xml in each eval table document record?
Would a FFS hint be applicable to an xmlindex domain-type index?
Here is the xmlindex definition:
CREATE INDEX "EVAL_XMLINDEX_IX" ON "EVAL" (OBJECT_VALUE)
INDEXTYPE IS "XDB"."XMLINDEX" PARAMETERS
('XMLTable eval_idx_tab XMLNamespaces(DEFAULT ''http://www.cigna.com/acme/domains/eval/2010/03'',
''http://www.cigna.com/acme/domains/derived/fact/2010/03'' AS "ns7"),''/eval''
COLUMNS defId VARCHAR2(100) path ''/derivedFacts/ns7:derivedFact/ns7:defId''');Here is the eval table definition:
CREATE
TABLE "N98991"."EVAL" OF XMLTYPE
CONSTRAINT "EVAL_ID_PK" PRIMARY KEY ("EVAL_ID") USING INDEX PCTFREE 10
INITRANS 4 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT
1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE
DEFAULT) TABLESPACE "ACME_DATA" ENABLE
XMLTYPE STORE AS SECUREFILE BINARY XML
TABLESPACE "ACME_DATA" ENABLE STORAGE IN ROW CHUNK 8192 CACHE NOCOMPRESS
KEEP_DUPLICATES STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT)
ALLOW NONSCHEMA ALLOW ANYSCHEMA VIRTUAL COLUMNS
"EVAL_DT" AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03"; (::)
/eval/@eval_dt'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
WITH
TIME ZONE))),
"EVAL_CAT" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@category'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
"ACME_MBR_ID" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@acmeMemberId'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50))),
"EVAL_ID" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@evalId'
PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
16777216,0),50,1,2) AS VARCHAR2(50)))
PCTFREE 0 PCTUSED 80 INITRANS 4 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
TABLESPACE "ACME_DATA" ; Sample cleansed xml snippet:
<?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?><eval createdById="xxxx" hhhhMemberId="37e6f05a-88dc-41e9-a8df-2a2ac6d822c9" category="eeeeeeee" eval_dt="2012-02-11T23:47:02.645Z" evalId="12e007f5-b7c3-4da2-b8b8-4bf066675d1a" xmlns="http://www.xxxxx.com/vvvv/domains/eval/2010/03" xmlns:ns2="http://www.cigna.com/nnnn/domains/derived/fact/2010/03" xmlns:ns3="http://www.xxxxx.com/vvvv/domains/common/2010/03">
<derivedFacts>
<ns2:derivedFact>
<ns2:defId>12345</ns2:defId>
<ns2:defUrn>urn:mmmmrunner:Medical:Definition:DerivedFact:52657:1</ns2:defUrn>
<ns2:factSource>tttt Member</ns2:factSource>
<ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
<ns2:factValue>
<ns2:type>boolean</ns2:type>
<ns2:value>true</ns2:value>
</ns2:factValue>
</ns2:derivedFact>
<ns2:derivedFact>
<ns2:defId>52600</ns2:defId>
<ns2:defUrn>urn:ddddrunner:Medical:Definition:DerivedFact:52600:2</ns2:defUrn>
<ns2:factSource>cccc Member</ns2:factSource>
<ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
<ns2:factValue>
<ns2:type>string</ns2:type>
<ns2:value>null</ns2:value>
</ns2:factValue>
</ns2:derivedFact>
<ns2:derivedFact>
<ns2:defId>59543</ns2:defId>
<ns2:defUrn>urn:ddddunner:Medical:Definition:DerivedFact:52599:1</ns2:defUrn>
<ns2:factSource>dddd Member</ns2:factSource>
<ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
<ns2:factValue>
<ns2:type>string</ns2:type>
<ns2:value>INT</ns2:value>
</ns2:factValue>
</ns2:derivedFact>
With the repeating <ns2:derivedFact> element continuing under the <derivedFacts>The Oracle XML DB Developer's Guide 11g Release 2 isn't helping much...
Any assitance much appreciated.
Regards,
Rick Blanchardodie 63, et. al.;
Attached is the reworked select query, xmlindex, and 2ndary indexes. Note: though namespaces are used; we're not registering any schema defns.
SELECT /*+ NO_USE_HASH(eval) +/ --/*+ NO_QUERY_REWRITE no_parallel(eval)*/
eval_xml.eval_catt, df.defid FROM eval,
--df.defid FROM eval,
XMLTable(XMLNamespaces( DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03',
'http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7" ),
'/eval' passing eval.object_value
COLUMNS
eval_catt VARCHAR2(50) path '@category',
derivedFact XMLTYPE path '/derivedFacts/ns7:derivedFact')eval_xml,
XMLTable(XMLNamespaces('http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7",
DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03'),
'/ns7:derivedFact' passing eval_xml.derivedFact
COLUMNS
defid VARCHAR2(100) path 'ns7:defId') df
WHERE df.defid IN ('52657','52599') AND eval_xml.eval_catt LIKE 'external';
--where df.defid = '52657';
SELECT /*+ NO_USE_HASH(eval +/ --/*+ NO_QUERY_REWRITE no_parallel(eval)*/
eval_xml.eval_catt, df.defid FROM eval,
--df.defid FROM eval,
XMLTable(XMLNamespaces( DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03',
'http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7" ),
'/eval' passing eval.object_value
COLUMNS
eval_catt VARCHAR2(50) path '@category',
derivedFact XMLTYPE path '/derivedFacts/ns7:derivedFact')eval_xml,
XMLTable(XMLNamespaces('http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7",
DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03'),
'/ns7:derivedFact' passing eval_xml.derivedFact
COLUMNS
defid VARCHAR2(100) path 'ns7:defId') df
WHERE df.defid IN ('52657','52599') AND eval_xml.eval_catt LIKE 'external';
--where df.defid = '52657'; create index defid_2ndary_ix on eval_idx_tab_II (defID);
eval_catt VARCHAR2(50) path ''@CATEGORY''');
create index eval_catt_2ndary_ix on eval_idx_tab_I (eval_catt);The xmlindex is getting picked up but a couple of problesm:
1. In the developemnt environment, no xml source records for defid '52657' or '52599' are being displayed - just an empty output set occurs; in spite of these values being present and stored in the source xml.
This really has me stumped, as can query the eval table to see the actual xml defid vaues '52657' and '52599' exist. Something appears off with the query - which didn't return records even before the corrresponding xml index was created.
2. The query still performs slowly, in spite of using the xmlindex. The execution plan shows a full table scan of eval occurring whether or not a HASH JOIN or MERGE JOIN (gets used in place of the HASH JOIN when the NO_USE_HASH(eval) int is used.
3. Single column 2ndary indexes created respectively for eval_catt and defid are not used in the execution plan - which may be expected upon further consideration.
In the process of running stats at this moment, to see if performance improves....
At this point, really after why item '1.' is occurring?
Edited by: RickBlanchardSRSCigna on Apr 16, 2012 1:33 PM -
Insert data into the xml schema-based xmltype table problem!
Hello, there,
I got problem in inserting data into the xmltype table after registered XML schema and created table. details see below:
1) xml schema:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Constantin Ilea (EMERGIS INC) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" targetNamespace="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" elementFormDefault="qualified">
<!-- ************** PART I: BEGIN SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
<xs:simpleType name="RoutingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Synch"/>
<xs:enumeration value="Asynch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="StatusType">
<xs:restriction base="xs:string">
<xs:enumeration value="ACTIVE"/>
<xs:enumeration value="VOID"/>
<xs:enumeration value="PENDING"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SenderApplicationType">
<xs:restriction base="xs:string">
<xs:enumeration value="PR"/>
<xs:enumeration value="CR"/>
<xs:enumeration value="POS"/>
<xs:enumeration value="CPP"/>
<xs:enumeration value="Other"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ServiceTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="IS"/>
<xs:enumeration value="WS"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RouteDirect">
<xs:restriction base="xs:string">
<xs:enumeration value="Request"/>
<xs:enumeration value="Reply"/>
<xs:enumeration value="None"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Indicator">
<xs:annotation>
<xs:documentation>can we also change the value to "ON" and "OFF" instead? in this way this cn be shared by all type of switch indicator</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="YES"/>
<xs:enumeration value="NO"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="RuleType">
<xs:restriction base="xs:string">
<xs:enumeration value="ControlAct"/>
<xs:enumeration value="WSPolicy"/>
<xs:enumeration value="AccessControl"/>
<xs:enumeration value="Certification"/>
<xs:enumeration value="MessageConformance"/>
<xs:enumeration value="Variant"/>
<xs:enumeration value="Routing"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="HL7Result">
<xs:restriction base="xs:string">
<xs:enumeration value="ACCEPT"/>
<xs:enumeration value="REFUSE"/>
<xs:enumeration value="REJECT"/>
<xs:enumeration value="ACK"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="IIPType">
<xs:restriction base="xs:string">
<xs:enumeration value="PUT"/>
<xs:enumeration value="GET/LIST"/>
<xs:enumeration value="NOTIF"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ProfileTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="IIPProfile"/>
<xs:enumeration value="BizOperationProfile"/>
<xs:enumeration value="OrchestrationProfile"/>
<xs:enumeration value="DomainObjectProfile"/>
<xs:enumeration value="ServiceProfile"/>
<xs:enumeration value="ExceptionProfile"/>
<xs:enumeration value="CustomizedProfile"/>
<xs:enumeration value="SystemProfile"/>
<xs:enumeration value="HL7XMLSchemaProfile"/>
<xs:enumeration value="EnricherParametersProfile"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterType">
<xs:restriction base="xs:string">
<xs:enumeration value="String"/>
<xs:enumeration value="Object"/>
<xs:enumeration value="Number"/>
<xs:enumeration value="Document"/>
</xs:restriction>
</xs:simpleType>
<!-- ************** PART I: END SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
<!-- ************** PART II: BEGIN COMPLEX OBJECT TYPE DEFINITIONS ********************************** -->
<!-- *********************** begin new added objects, by rshan *************************************** -->
<xs:complexType name="ProfileType">
<xs:annotation>
<xs:documentation>
1.Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
2.ProfileID used to uniquely identify the current profile
3.ProfileData used to hold all the necessary profile related data
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="ProfileID" type="ProfileIDType">
<xs:annotation>
<xs:documentation>this will hold all the common attributes, espically the global unique identifier to the profile, no matter what type of profile is</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ProfileData" type="ProfileDataType">
<xs:annotation>
<xs:documentation>all the non-common profile meta data that attached to each specific profile type such as IIPProfile, OrchestrationProfile, and BizOperationProfile will be placed here</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProfileIDType">
<xs:annotation>
<xs:documentation>global unique identifier and all the common attributes across all different profiles, the @ID and @Type together will be used as the primary key to identify the profile data</xs:documentation>
</xs:annotation>
<xs:attribute name="ID" type="xs:ID" use="required">
<xs:annotation>
<xs:documentation>ID is the global unique identifier to the profile, no matter what type of profile it is</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Name"/>
<xs:attribute name="Description"/>
<xs:attribute name="Version">
<xs:annotation>
<xs:documentation>version of the profile data</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Type" type="ProfileTypeType" use="required">
<xs:annotation>
<xs:documentation>value to identify the ProfileType type within
IIPProfile,BizOperationProfile,OrchestrationProfile,DomainObjectProfile
ServiceProfile,ExceptionProfile,SystemProfile,HL7XMLSchemaProfile,
EnricherParametersProfile,CustomizedProfile
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Status" type="StatusType" default="ACTIVE">
<xs:annotation>
<xs:documentation>used to show the related profile data status like "ACTIVE","PENDING","VOID"...</xs:documentation>
</xs:annotation>
</xs:attribute>
<!--
<xs:sequence>
<xs:element name="ProfileReference" type="ProfileIDType" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>this will be the place to hold the integrity relationship with other profiles like foreign key if existed and necessary to show up</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
-->
</xs:complexType>
<xs:complexType name="ProfileDataType">
<xs:annotation>
<xs:documentation>meta data associated tightly to each specific type of profile</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:element name="EnricherParametersProfileData" type="EnricherParametersDataType">
<xs:annotation>
<xs:documentation>Enricher Parameters related profile data
1. one instance of this type may contains all the related System metadata.
2. idType part may use to identify different version/release/status
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ExtendProfileData" type="ExtendProfileDataType">
<xs:annotation>
<xs:documentation>If needed, any profile data not defined within the current release scope can be added here </xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="ExtendProfileDataType">
<xs:sequence>
<xs:element name="ExtendProfile" type="xs:anyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EnricherParametersDataType">
<xs:sequence>
<xs:element name="EnricherParameter" type="EnricherParameter" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EnricherParameter">
<xs:sequence>
<xs:element ref="Enricher"/>
</xs:sequence>
<xs:attribute name="serviceName" type="xs:string" use="required"/>
<xs:attribute name="interactionID" type="xs:string"/>
</xs:complexType>
<xs:element name="Enricher">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Parameters" type="Parameters"/>
<xs:element ref="Section" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ValueType">
<xs:attribute name="field" use="required"/>
<xs:attribute name="value"/>
<xs:attribute name="action"/>
</xs:complexType>
<xs:element name="Section">
<xs:complexType>
<xs:sequence>
<xs:element name="Value" type="ValueType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="path" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="Parameters">
<xs:sequence>
<xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" use="required"/>
<xs:attribute name="reference"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RuleList">
<xs:annotation>
<xs:documentation>an array of rules</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Rule" type="RuleProfile" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RuleProfile">
<xs:attribute name="RName" use="required"/>
<xs:attribute name="RType" type="RuleType" use="required"/>
<xs:attribute name="Status" default="ON">
<xs:annotation>
<xs:documentation>By default is ON (or if is missing)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Order"/>
<xs:attribute name="Direction" type="RouteDirect">
<xs:annotation>
<xs:documentation>Request / Reply</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ************** PART II: END COMPLEX OBJECT TYPE DEFINITIONS *********************************** -->
<!-- ************** PART III: BEGIN ROOT ELEMENTS DEFINITIONS ********************************* -->
<!-- 0) Profile wrapper root element
Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
-->
<xs:element name="Profile" type="ProfileType">
<xs:annotation>
<xs:documentation>Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
2)register xml schema:
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaurl=>'http://rac3-1-vip:8080/home/'||USER||'/xsd/EHIPProfile_v00.xsd',
5 schemadoc=>xdbURIType('/home/'||USER||'/xsd/EHIPProfile_v00.xsd').getClob(),
6 local=>True,
7 gentypes=>True,
8 genbean=>False,
9 gentables=>False
10 );
11 End;
12 /
PL/SQL procedure successfully completed.
SQL>
SQL>
3) xml data:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<Profile xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1">
<ProfileID Type="EnricherParametersProfile" Status="ACTIVE" ID="EnricherPP.ID.0001" Name="EnricherPP.ID.0001" Description="EnricherPP.ID.0001" Version="01"/>
<ProfileData>
<EnricherParametersProfileData>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.ExceptionCreators:createExceptionV50CategoryCanonicalPart" interactionID="">
<Enricher>
<Parameters>
<Parameter name="MESSAGE_ID" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="RESPONSE_TYPE">
<Value field="value" value="I"/>
</Section>
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="HL7V3"/>
</Section>
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<Section path="SENDING_NETWORK_ADDRESS">
<Value field="value" value=""/>
</Section>
<Section path="SENDING_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_APPLICATION_NAME">
<Value field="value" value="NL HIAL"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectCreators:createFindClientsAssociatedIdentifersRequestObject" interactionID="PRPA_IN101105CA">
<Enricher>
<Parameters>
<Parameter name="MESSAGE_ID" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="RESPONSE_TYPE">
<Value field="value" value="I"/>
</Section>
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="HL7V3"/>
</Section>
<Section path="PROCESSING_CODE">
<Value field="value" value="T"/>
</Section>
<!--
<Section path="PROCESSING_MODE_CODE">
<Value field="value" value="T"/>
</Section>
-->
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<Section path="RECEIVER_NETWORK_ADDRESS">
<Value field="value" value="prsunew.moh.hnet.bc.ca"/>
</Section>
<Section path="RECEIVER_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.40.5.1"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_NETWORK_ADDRESS">
<Value field="value" value=""/>
</Section>
<Section path="SENDING_APPLICATION_IDENTIFIER">
<Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
<Value field="extension" value=""/>
</Section>
<Section path="SENDING_APPLICATION_NAME">
<Value field="value" value="NL HIAL"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
<EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectContentEnrichers:enrichPRRequest" interactionID="">
<!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<Enricher>
<Parameters>
<Parameter name="MESSAGE_IDENTIFIER" reference="test"/>
</Parameters>
<Section path="HEADER">
<Section path="HL7_STANDARD_VERSION">
<Value field="value" value="V3PR2"/>
</Section>
<!--POS/CPP populated ?-->
<!--Not sure if this should be set as a variance within EHIP or if we expect the POS/CPP to provide this value-->
<Section path="PROCESSING_CODE">
<Value field="value" value="T"/>
</Section>
<!--POS/CPP populated ?-->
<Section path="PROCESSING_MODE_CODE">
<Value field="value" value="T"/>
</Section>
<!--POS/CPP populated ?-->
<Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
<Value field="value" value="NE"/>
</Section>
<!-- note:We Expect PRS to give us a web service address -->
<!--<Section path="RECEIVER_NETWORK_ADDRESS">
<Value field="value" value="_http://PRSServer/svcName"/>
</Section>
-->
<Section path="RECEIVER_APPLICATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.3.40.1.14"/>
<Value field="extension" value="SIT1"/>
</Section>
<!-- note: values of the fields to be provided by PRS -->
<Section path="RECEIVER_APPLICATION_NAME[0]">
<Value field="value" value="receiverAppName"/>
</Section>
<!-- note: RECEIVER_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
<!-- note: values of the fields to be specified by PRS later -->
<Section path="RECEIVER_AGENT/RECEIVER_ORGANIZATION/RECEIVER_ORGANIZATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.3.40.4.1"/>
<Value field="extension" value="receiverOrgId"/>
</Section>
<Section path="SENDING_APPLICATION_NAME[0]">
<Value field="value" value="NLPRSCLNT"/>
</Section>
<!-- note: SENDING_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
<!-- note: values of the fields to be specified by PRS later -->
<Section path="SENDING_AGENT/SENDING_ORGANIZATION/SENDING_ORGANIZATION_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.4.3.57"/>
<Value field="extension" value="3001"/>
</Section>
<Section path="PERFORMER/HEALTHCARE_WORKER_IDENTIFIER[0]">
<Value field="root" value="2.16.840.1.113883.4.3.57"/>
<Value field="extension" value="HIAL_USR"/>
</Section>
</Section>
<Section path="PAYLOAD">
<!--<Section path="QUERY_STATUS_CODE">
<Value field="value" value="New"/>
</Section>-->
<!-- note: AUDIT has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="AUDIT[0]/AUDIT_INFORMATION">
<Value field="code" value="LATEST"/>
<Value field="codeSystem" value="PRSAuditParameters"/>
</Section>
<!-- note: CONFIDENCE has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="CONFIDENCE/CONFIDENCE_VALUE">
<Value field="value" value="100"/>
</Section>
<!-- note: HISTORY has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="HISTORY/INCLUDE_HISTORY_INDICATOR">
<Value field="value" value="false"/>
</Section>
<!-- note: JURISDICTION has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="JURISDICTION/JURISDICTION_TYPE">
<Value field="value" value="NL"/>
</Section>
<!-- note: RESPONSE_OBJECT has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[0]">
<Value field="code" value="GRS_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[1]">
<Value field="code" value="GRS_ELECTRONIC_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[2]">
<Value field="code" value="GRS_IDENTIFIER"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[3]">
<Value field="code" value="GRS_ORGANIZATION_NAME"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[4]">
<Value field="code" value="GRS_PERSONAL_NAME"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[5]">
<Value field="code" value="GRS_REGISTRY_IDENTIFIER"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[6]">
<Value field="code" value="GRS_TELEPHONE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[7]">
<Value field="code" value="PRS_CONDITION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[8]">
<Value field="code" value="PRS_CONFIDENTIALITY_INDICATOR"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[9]">
<Value field="code" value="PRS_DEMOGRAPHIC_DETAIL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[10]">
<Value field="code" value="PRS_DISCIPLINARY_ACTION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[11]">
<Value field="code" value="PRS_INFORMATION_ROUTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[12]">
<Value field="code" value="PRS_NOTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[13]">
<Value field="code" value="PRS_PROVIDER_CREDENTIAL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[14]">
<Value field="code" value="PRS_PROVIDER_EXPERTISE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[15]">
<Value field="code" value="PRS_PROVIDER_RELATIONSHIP"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[16]">
<Value field="code" value="PRS_STATUS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[17]">
<Value field="code" value="PRS_WORK_LOCATION"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[18]">
<Value field="code" value="PRS_WORK_LOCATION_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[19]">
<Value field="code" value="PRS_WORK_LOCATION_DETAIL"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[20]">
<Value field="code" value="PRS_WORK_LOCATION_ELECTRONIC_ADDRESS"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[21]">
<Value field="code" value="PRS_WORK_LOCATION_INFORMATION_ROUTE"/>
</Section>
<Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[22]">
<Value field="code" value="PRS_WORK_LOCATION_TELEPHONE"/>
</Section>
<!-- note: ROLE_CLASS has an extra trailing space, as in the Excel mapping spreadsheet -->
<Section path="ROLE_CLASS /ROLE_CLASS_VALUE">
<Value field="value" value="LIC"/>
</Section>
<Section path="SORT_CONTROL[0]/SORT_CONTROL_ELEMENT_NAME">
<Value field="code" value="PrincipalPerson.name.value.family"/>
</Section>
<Section path="SORT_CONTROL[0]/SORT_CONTROL_DIRECTION_CODE">
<Value field="value" value="A"/>
</Section>
</Section>
</Enricher>
</EnricherParameter>
</EnricherParametersProfileData>
</ProfileData>
</Profile>
the data is valid against the schema through XML Spy tool... and loaded into the XDB repository...
4) create table and insert data:
SQL> CREATE TABLE EHIP_PROFILE OF SYS.XMLTYPE
2 XMLSCHEMA "http://rac3-1-vip:8080/home/EHIPSBUSER1/xsd/EHIPProfile_v00.xsd" ELEMENT "Profile"
3 ;
Table created.
SQL>
SQL> alter table EHIP_PROFILE
2 add CONSTRAINT EHIP_PROF_PK PRIMARY KEY(XMLDATA."ProfileID"."ID",XMLDATA."ProfileID"."Type");
Table altered.
SQL>
SQL>
SQL>
SQL>
SQL> select xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob() from dual;
XDBURITYPE('/HOME/'||USER||'/PROFILEDATA/ENRICHERPP.ID.0001.XML').GETCLOB()
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy
SQL>
SQL>
SQL> insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()));
insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()))
ERROR at line 1:
ORA-21700: object does not exist or is marked for delete
what's the problem caused the "ORA-21700: object does not exist or is marked for delete" error?
Thanks in advance for your help?Thanks Marco,
Here're my environment:
SQL> select INSTANCE_NUMBER, INSTANCE_NAME,HOST_NAME,VERSION from v$instance;
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION
2 rac32 RAC3-2 10.2.0.3.0
I followed your suggested in the above, and always purge recyclebin, but still got the same problem. because in 10gr2, there's no dbms_xmlschema.purge_schema available,
and I did checked the recyclebin after force the delete of schema, nothing inside. any other recommendation?
Maybe you are looking for
-
ASA 5505 Site to Site VPN issue
I have been trying to configure a siste to site vpn for a few days now, but not able to get it to connect. The only difference between the two, is one has a dynamic ip. this vpn isn't a priority, so there isn't a need to have the dynamic moved to a s
-
How do I get microsoft office restored on mountain lion?
I have just upgraded with CD to Snow Leopard and then to Mountain Lion. But Microsoft Office is no longer supported. Can I download Office to get to my work?
-
My Browser search has been Hijacked, How do I get rid of this. It does not do this in IE. Please help cause I do not want to use IE unless I have to. I have tried different anti virus programs but its still here. Michael
-
Duplicate responsibility on end date
Hi, We have EBS 11.5.10.2 on AIX servers. When I try to end date one responsibilty it ends but it duplicates and I can not end the new one. I checked metalink and found patch 5121512 which is superseded by patch 6241631. I am a newbie and I dare not
-
Dual monitors dont work with gaming?
I have a video card (just one with dual output) that allows me to run separate programs on each monitor, but not if I am running a video game. Are all VC like this where I cant game on one monitor and keep Excel up on the other? Thanks