Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-19279 How do I write a query to return the data?

596480Jul 30 2008 — edited Jul 30 2008
I have XMLType tables in Oracle 11. I insert XML data from documents and each table only contains one XML document. I can write queries to return outer tags and inner tags but not outer and inner tags in the same result set. There can be one to many InvoiceLineRet tags to each InvoiceRet tag.

Any and all help is appreciated.

Mike



This works and returns RefNumber for the invoice at the InvoiceRet level.

SELECT
a.RefNumber
FROM InvoiceQueryRs xt,
XMLTable('//InvoiceRet' PASSING xt.OBJECT_VALUE COLUMNS
RefNumber VARCHAR2(255) PATH 'RefNumber') a;

This works and returns the two columns from the InvoiceLineRet level.

SELECT
b.ILR_ItemRef_FullName,
b.ILR_Desc
FROM InvoiceQueryRs xt,
XMLTable('//InvoiceLineRet' PASSING xt.OBJECT_VALUE COLUMNS
ILR_ItemRef_FullName VARCHAR2(255) PATH 'ItemRef/FullName',
ILR_Desc VARCHAR2(2000) PATH 'Desc') b

But a query like this does not work.

SELECT
b.RefNumber,
b.ILR_ItemRef_FullName,
b.ILR_Desc
FROM InvoiceQueryRs xt,
XMLTable('//InvoiceRet' PASSING xt.OBJECT_VALUE COLUMNS
RefNumber VARCHAR2(255) PATH 'RefNumber',
ILR_ItemRef_FullName VARCHAR2(255) PATH 'InvoiceLineRet/ItemRef/FullName',
ILR_Desc VARCHAR2(2000) PATH 'InvoiceLineRet/Desc') b

This query returns data but every row has the same RefNumber.

SELECT
a.RefNumber,
b.ILR_ItemRef_ListID,
b.ILR_ItemRef_FullName,
b.ILR_Desc
FROM InvoiceQueryRs xt,
XMLTable('//InvoiceRet' PASSING xt.OBJECT_VALUE COLUMNS
RefNumber VARCHAR2(255) PATH 'RefNumber') a,
XMLTable('//InvoiceLineRet' PASSING xt.OBJECT_VALUE COLUMNS
ILR_ItemRef_ListID VARCHAR2(255) PATH 'ItemRef/ListID',
ILR_ItemRef_FullName VARCHAR2(255) PATH 'ItemRef/FullName',
ILR_Desc VARCHAR2(2000) PATH 'Desc') b

Example of the XML:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
<TEST>
<InvoiceRet>
<TxnID>D924-1210085400</TxnID>
<TimeCreated>2008-05-06T10:50:00-05:00</TimeCreated>
<TimeModified>2008-07-21T10:54:42-05:00</TimeModified>
<EditSequence>1215638595</EditSequence>
<TxnNumber>10398</TxnNumber>
<CustomerRef>
<ListID>80000278-1209483158</ListID>
<FullName>Majestic Entries</FullName>
</CustomerRef>
<ARAccountRef>
<ListID>80000009-1185470478</ListID>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TemplateRef>
<ListID>80000019-1190228214</ListID>
<FullName>Compudoc</FullName>
</TemplateRef>
<TxnDate>2008-05-06</TxnDate>
<RefNumber>22333</RefNumber>
<BillAddress>
<Addr1>Majetic Entries</Addr1>
</BillAddress>
<BillAddressBlock>
<Addr1>Majetic Entries</Addr1>
</BillAddressBlock>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<DueDate>2008-05-06</DueDate>
<ShipDate>2008-05-06</ShipDate>
<Subtotal>391.50</Subtotal>
<ItemSalesTaxRef>
<ListID>8000004F-1185996977</ListID>
<FullName>NC 7.25%</FullName>
</ItemSalesTaxRef>
<SalesTaxPercentage>7.25</SalesTaxPercentage>
<SalesTaxTotal>5.73</SalesTaxTotal>
<AppliedAmount>-397.23</AppliedAmount>
<BalanceRemaining>0.00</BalanceRemaining>
<IsPaid>true</IsPaid>
<IsToBePrinted>false</IsToBePrinted>
<IsToBeEmailed>false</IsToBeEmailed>
<CustomerSalesTaxCodeRef>
<ListID>80000001-1185469345</ListID>
<FullName>Tax</FullName>
</CustomerSalesTaxCodeRef>
<InvoiceLineRet>
<TxnLineID>D926-1210085400</TxnLineID>
<ItemRef>
<ListID>80000059-1199714336</ListID>
<FullName>Labor:Non-Contract Labor Ken</FullName>
</ItemRef>
<Desc>Technical Labor performed by Ken Allen:
Network Problem with Internet and intranet found two routers connected together and the one set for DHCP was bad we changed out their bad one with our small netgear router.</Desc>
<Quantity>1.5</Quantity>
<Rate>125.00</Rate>
<ClassRef>
<ListID>8000000D-1200208143</ListID>
<FullName>KA</FullName>
</ClassRef>
<Amount>187.50</Amount>
<ServiceDate>2008-04-28</ServiceDate>
<SalesTaxCodeRef>
<ListID>80000002-1185469345</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>D927-1210085400</TxnLineID>
<ItemRef>
<ListID>80000029-1185470511</ListID>
<FullName>Labor:Non-Contract Labor Rick</FullName>
</ItemRef>
<Desc>Technical Labor performed by Rick Wagoner: Assisted with above troubleshooting</Desc>
<Quantity>1</Quantity>
<Rate>125.00</Rate>
<ClassRef>
<ListID>80000004-1185998300</ListID>
<FullName>RW</FullName>
</ClassRef>
<Amount>125.00</Amount>
<ServiceDate>2008-04-28</ServiceDate>
<SalesTaxCodeRef>
<ListID>80000002-1185469345</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>D928-1210085400</TxnLineID>
<ItemRef>
<ListID>80000050-1185997340</ListID>
<FullName>Parts and Supplies</FullName>
</ItemRef>
<Desc>Parts and Supplies: Netgear router</Desc>
<Quantity>1</Quantity>
<Rate>79.00</Rate>
<ClassRef>
<ListID>80000007-1186694551</ListID>
<FullName>Parts</FullName>
</ClassRef>
<Amount>79.00</Amount>
<SalesTaxCodeRef>
<ListID>80000001-1185469345</ListID>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
</InvoiceRet>
<InvoiceRet>
<TxnID>ED59-1216758177</TxnID>
<TimeCreated>2008-07-22T16:22:57-05:00</TimeCreated>
<TimeModified>2008-07-26T11:21:48-05:00</TimeModified>
<EditSequence>1217085708</EditSequence>
<TxnNumber>11203</TxnNumber>
<CustomerRef>
<ListID>80000278-1209483158</ListID>
<FullName>Majestic Entries</FullName>
</CustomerRef>
<ARAccountRef>
<ListID>80000009-1185470478</ListID>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TemplateRef>
<ListID>80000019-1190228214</ListID>
<FullName>Compudoc</FullName>
</TemplateRef>
<TxnDate>2008-07-22</TxnDate>
<RefNumber>22479</RefNumber>
<BillAddress>
<Addr1>Majetic Entries</Addr1>
</BillAddress>
<BillAddressBlock>
<Addr1>Majetic Entries</Addr1>
</BillAddressBlock>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<DueDate>2008-07-22</DueDate>
<ShipDate>2008-07-22</ShipDate>
<Subtotal>839.00</Subtotal>
<ItemSalesTaxRef>
<ListID>8000004F-1185996977</ListID>
<FullName>NC 7.25%</FullName>
</ItemSalesTaxRef>
<SalesTaxPercentage>7.25</SalesTaxPercentage>
<SalesTaxTotal>33.64</SalesTaxTotal>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>872.64</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
<IsToBeEmailed>false</IsToBeEmailed>
<CustomerSalesTaxCodeRef>
<ListID>80000001-1185469345</ListID>
<FullName>Tax</FullName>
</CustomerSalesTaxCodeRef>
<InvoiceLineRet>
<TxnLineID>ED5B-1216758177</TxnLineID>
<ItemRef>
<ListID>80000050-1185997340</ListID>
<FullName>Parts and Supplies</FullName>
</ItemRef>
<Desc>Parts and Supplies - Linksys Router</Desc>
<Quantity>1</Quantity>
<Rate>89.00</Rate>
<Amount>89.00</Amount>
<SalesTaxCodeRef>
<ListID>80000001-1185469345</ListID>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED5C-1216758177</TxnLineID>
<Desc>Suspect that the phone switch is attempting to act as a DHCP server for the network. per Terry, the reason that the phone switch was on the network was to supply VOIP to the warehouse phone lines. This was not working and is no longer needed. We removed the connection between the phone switch and the network.</Desc>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED5D-1216758177</TxnLineID>
<Desc>Removed the Netgear router and the D-Link router. The D-Link had lost all settings and we could not log into the Netgear even after resetting to factory defaults.</Desc>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED5E-1216758177</TxnLineID>
<Desc>Installed a new Lnksys router to replace the D-Link and Netgear faulty routers.</Desc>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED5F-1216758177</TxnLineID>
<Desc>Ensured that all computers were connecting properly. Ensured that all computers printed to the Savin printer correctly.</Desc>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED60-1216758177</TxnLineID>
<Desc>Worked with Time Warner Cable to resolve customer location and static IP.</Desc>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED64-1216758177</TxnLineID>
<ItemRef>
<ListID>80000028-1185470511</ListID>
<FullName>Labor:Non-Contract Labor Kareem</FullName>
</ItemRef>
<Desc>Analyzed and resolved Internet connectivity problems after loss of service from Time Warner Cable.</Desc>
<Quantity>3</Quantity>
<Rate>125.00</Rate>
<Amount>375.00</Amount>
<ServiceDate>2008-07-22</ServiceDate>
<SalesTaxCodeRef>
<ListID>80000002-1185469345</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED68-1216758177</TxnLineID>
<ItemRef>
<ListID>8000005D-1216758445</ListID>
<FullName>Labor:Non-Contract Labor Mike</FullName>
</ItemRef>
<Desc>Analyzed and resolved Internet connectivity problems after loss of service from Time Warner Cable.</Desc>
<Quantity>3</Quantity>
<Rate>125.00</Rate>
<Amount>375.00</Amount>
<ServiceDate>2008-07-22</ServiceDate>
<SalesTaxCodeRef>
<ListID>80000001-1185469345</ListID>
<FullName>Tax</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED94-1216758177</TxnLineID>
<Desc>Terry called, cannot connect to internet. Everyone but Terry can connect. Terry is getting a 172 IP address on his laptop. Walked him through putting a static IP on his laptop so that he could be functional. I went to their site and talked with the NEC phone switch management company. They said the switch does not have DHCP capabilities. I could not duplicate Terry's issue using my laptop. The phone switch is now totally disconnected from the network since the VOIP setup for the warehouse was not functional. Validated that the TWC modem is not DHCP.</Desc>
<ServiceDate>2008-07-23</ServiceDate>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>ED95-1216758177</TxnLineID>
<Desc>Requires further diagnostics on Friday the 25th (if Terry is available) - need his laptop on-site to diagnose the problem.</Desc>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>EE30-1216758177</TxnLineID>
<Desc>Communicated with Terry on 7/24/2008 via email. He is using DHCP and connecting correctly. Removing the final connection from the phone switch to the network appears to have corrected the problem.</Desc>
<ServiceDate>2008-07-24</ServiceDate>
</InvoiceLineRet>
</InvoiceRet>
</TEST>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2008
Added on Jul 30 2008
1 comment
724 views