How to select values of nested elements that have maxOccurs="unbounded"

I have the following xml schema and xml data:
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:qbl="http://10.0.1.233:8080/home/cpa/xsd/qbl.xsd" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" xdb:storeVarrayAsTable="true">
<xs:element name="QBL_Envelope" type="QBL_Envelope_Type" xdb:defaultTable="MYQBL"/>
     <xs:complexType name="QBL_Envelope_Type">
     <xs:sequence>
               <xs:element ref="Transmission_Date" minOccurs="0"/>
               <xs:element ref="QBL" maxOccurs="unbounded"/>
          </xs:sequence>
     </xs:complexType>
<xs:element name="Transmission_Date" type="xs:string"/>
<xs:element name="QBL">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="QBL_Number"/>
                    <xs:element ref="Priority"/>
                    <xs:element ref="Date_Prepared"/>
                    <xs:element ref="Line_Item" maxOccurs="unbounded"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="QBL_Number" type="xs:string"/>
<xs:element name="Priority" type="xs:string"/>
<xs:element name="Date_Prepared" type="xs:string"/>     
     <xs:element name="Line_Item">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="Item_Name" maxOccurs="unbounded"/>
                    <xs:element ref="Line_Item_Weight"/>
                    <xs:element ref="Line_Item_Cube_Info"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="Line_Item_Cube_Info">
          <xs:complexType>
               <xs:sequence>
                    <xs:element ref="Line_Item_Cube" minOccurs="0"/>
                    <xs:element ref="Line_Item_Cube_Qualifier" minOccurs="0"/>
               </xs:sequence>
          </xs:complexType>
     </xs:element>
     <xs:element name="Line_Item_Cube" type="xs:string"/>
<xs:element name="Line_Item_Cube_Qualifier" type="xs:string"/>
<xs:element name="Item_Name" type="xs:string"/>
     <xs:element name="Line_Item_Weight" type="xs:string"/>
</xs:schema>
insert into MYQBL values(
xmltype('<QBL_Envelope>
     <Transmission_Date>030531</Transmission_Date>
     <QBL>
          <QBL_Number>316180J2</QBL_Number>
          <Priority>3</Priority>
          <Date_Prepared>20030530</Date_Prepared>
          <Line_Item>
               <Item_Name>FREIGHT ALL KINDS</Item_Name>
<Item_Name>Specail Item</Item_Name>
               <Line_Item_Weight>0000212</Line_Item_Weight>
               <Line_Item_Cube_Info>
                    <Line_Item_Cube>31.1</Line_Item_Cube>
                    <Line_Item_Cube_Qualifier>E</Line_Item_Cube_Qualifier>
               </Line_Item_Cube_Info>
          </Line_Item>
<Line_Item>
               <Item_Name>AAAAAA</Item_Name>
<Item_Name>BBBBBBBB</Item_Name>
               <Line_Item_Weight>0000512</Line_Item_Weight>
               <Line_Item_Cube_Info>
                    <Line_Item_Cube>67.1</Line_Item_Cube>
                    <Line_Item_Cube_Qualifier>E</Line_Item_Cube_Qualifier>
               </Line_Item_Cube_Info>
          </Line_Item>
</QBL>
</QBL_Envelope>').createSchemaBasedXML('http://10.0.1.233:8080/home/cpa/xsd/qbl.xsd'));
My question is how to select
/QBL_Envelope/QBL/QBL_Number,
/QBL_Envelope/QBL/Line_Item/Item_Name,
/QBL_Envelope/QBL/Line_Item/Line_Item_Weight,
/QBL_Envelope/QBL/Line_Item/Line_Item_Cube_Info/Line_Item_Cube
/QBL_Envelope/QBL/Line_Item/Line_Item_Cube_Info/Line_Item_Cube_Qualifier
in a select stetament? (Note that these elements QBL_Number, Line_Item and Item_Name have maxOccurs="unbounded") actually I want to use the select statement to create a view.
I tried the following select statement and it works fine:
select extractValue(value(b), '/QBL/QBL_Number'),
extractValue(value(b), '/QBL/Priority'),
extractValue(value(b), '/QBL/Date_Prepared')
from egbl e, table(xmlsequence(extract(value(e), '/QBL_Envelope/QBL'))) b
Please advise. It is import to us. Thank you for your help in advance!!!
The database version is 9.2.0.3.0 and the operating system is Windows 2000.
Thanks,
Mary Wu

Hi Mark,
Thank you for your reply and I really appreciate!
I tried the select statement you gave me but I got error:
SQL*Plus: Release 9.2.0.3.0 - Production on Fri Aug 1 09:11:03 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.3.0 - Production
SQL> set long 10000;
SQL> set pagesize 10000
SQL> select * from myqbl;
SYS_NC_ROWINFO$
<QBL_Envelope>
<Transmission_Date>030531</Transmission_Date>
<QBL>
<QBL_Number>316180J2</QBL_Number>
<Priority>3</Priority>
<Date_Prepared>20030530</Date_Prepared>
<Line_Item>
<Item_Name>FREIGHT ALL KINDS</Item_Name>
<Item_Name>Specail Item</Item_Name>
<Line_Item_Weight>0000212</Line_Item_Weight>
<Line_Item_Cube_Info>
<Line_Item_Cube>31.1</Line_Item_Cube>
<Line_Item_Cube_Qualifier>E</Line_Item_Cube_Qualifier>
</Line_Item_Cube_Info>
</Line_Item>
<Line_Item>
<Item_Name>AAAAAA</Item_Name>
<Item_Name>BBBBBBBB</Item_Name>
<Line_Item_Weight>0000512</Line_Item_Weight>
<Line_Item_Cube_Info>
<Line_Item_Cube>67.1</Line_Item_Cube>
<Line_Item_Cube_Qualifier>E</Line_Item_Cube_Qualifier>
</Line_Item_Cube_Info>
</Line_Item>
</QBL>
</QBL_Envelope>
SQL> select extractValue(value(q), '/QBL/QBL_Number'),
2 extractValue(value(q), '/QBL/Priority'),
3 extractValue(value(q), '/QBL/Date_Prepared'),
4 extractValue(value(n), '/Item_Name'),
5 extractValue(value(l), '/Line_Item/Line_Item_Weight'),
6 extractValue(value(l), '/Line_Item/Line_Item_Cube_Info/Line_Item_Cube'),
7 extractValue(value(l), '/Line_Item/Line_Item_Cube_Info/Line_Item_Cube_Qualifier')
8 from MYQBL e,
9 table (xmlsequence(extract(value(e), '/QBL_Envelope/QBL'))) q,
10 table (xmlsequence(extract(value(q), '/QBL/Line_Item'))) l,
11 table (xmlsequence(extract(value(l), '/Line_Item/Item_Name'))) n;
select extractValue(value(q), '/QBL/QBL_Number'),
ERROR at line 1:
ORA-00904: "SYS_NT0jPUiVR5SS6VqgqEvU1LkQ=="."SYS_NC_ROWINFO$": invalid
identifier
SQL>
Do you have any idea about it?
Actually before I posted the message I had tried the same select statement and had got the same error.
Again, thank you very much and I really appreciate your help.
Mary Wu

Similar Messages

  • How to assign Values to nested table and pass as parameter to procedure?

    How to assign Values to nested table and pass as parameter to procedure?
    Below is the Object and its type
    create or replace type test_object1 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type1 is table of test_object1;
    create or replace type test_object2 as object
    val1 varchar2(50),
    val2 varchar2(50),
         val3 varchar2(50)
    create or replace type test_type2 is table of test_object2;
    GRANT ALL ON test_object1 TO PUBLIC;
    GRANT ALL ON test_type1 TO PUBLIC;
    GRANT ALL ON test_object2 TO PUBLIC;
    GRANT ALL ON test_type2 TO PUBLIC;
    here is the table made of object type:
    create table test_object_tpe
    sl_num NUMBER,
    description VARCHAR2(100),
    main_val1 test_type1,
    main_val2 test_type2
    NESTED TABLE main_val1 STORE AS tot1
    NESTED TABLE main_val2 STORE AS tot2;
    here is the procedure which inserts values into nested table:
    PROCEDURE INSERT_TEST_DATA(sl_num IN NUMBER,
    description IN VARCHAR2,
    p_main_val1 IN test_type1,
    p_main_val2 IN test_type2
    IS
    BEGIN
    FOR rec in p_main_val1.first..p_main_val1.last
    LOOP
    INSERT INTO xxdl.test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    sl_num
    ,description
    ,test_type1 (test_object1(
    p_main_val1(rec).val1,
                                       p_main_val1(rec).val2,
    p_main_val1(rec).val3
    ,test_type2 (test_object2( p_main_val2(rec).val1,
                        p_main_val2(rec).val2,
                        p_main_val2(rec).val3
    END LOOP;
    commit;
    END INSERT_TEST_DATA;
    here is the anonymoys block which assigns values to the object type and pass values into the procedure:
    set serveroutput on;
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1(1).val1 := 'testx1';
    inval1(1).val2 := 'testx2';
    inval1(1).val3 := 'testx3';
    inval2(1).val1 := 'testy1';
    inval2(1).val2 := 'testy2';
    inval2(1).val3 := 'testy3';
    CSI_PKG.INSERT_TEST_DATA(sl_num => p_sl_num,
    description => p_description,
    p_main_val1 => inval1,
    p_main_val2 => inval2
    end;
    Can anybody correct me.
    Thanks,
    Lavan

    Thanks for posting the DDL and sample code but whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    >
    How to assign Values to nested table and pass as parameter to procedure?
    >
    Well you are doing almost everything wrong that could be done wrong.
    Here is code that works to insert data into your table (the procedure isn't even needed).
    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1.extend();
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    inval2.extend();
    inval2(1) := test_object2('testy1', 'testy2', 'testy3');
    INSERT INTO test_object_tpe
    sl_num,
    description,
    main_val1,
    main_val2
    VALUES
    (p_sl_num, p_description, inval1, inval2);
    commit;
    end;
    /See Example 5-15 Referencing a Nested Table Element in Chap 5 Using PL/SQL Collections and Records in the PL/SQL doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm#CJABEBEA
    1. You don't even need the procedure since all it does is a simple INSERT into the table which you can do directly (see my code above)
    inval1(1).val1 := 'testx1';There is no element one (1) of 'inval1' since you haven't created any elements yet. You need to EXTEND the collection to add an element
    inval1.extend();And then there is an empty element but 'inval1' is a container for objects of type 'test_object1' not for scalars like 'val1', 'val2', and 'val3'.
    So you can't do
    inval1(1).val1 := 'testx1';You have to create an instance of 'test_object1'
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');And so on for the other collection
    You don't need the procedure (as my sample code shows) but once you populate the variables properly it will work.

  • I am trying to sync music from my iTunes library on my iMac to my iPhone. I only want selected music but I'm getting unwanted songs. How can I delete those songs on my iPhone or how can I prevent these unwanted songs that have not been selected from appea

    I am trying to sync music from my iTunes library on my iMac to my iPhone. I only want selected music but I'm getting unwanted songs. How can I delete those songs on my iPhone or how can I prevent these unwanted songs that have not been selected from appearing on my iPhone? Help!

    http://support.apple.com/kb/HT1296

  • How to select values frm table giving the condition value at runtime in SQL

    Hi All,
    How to select values from a table by giving the condition value at runtime in SQL
    My SQL statement is select * from employee where empno=<empno>, this empno I want to provide at run time. Also I don't have any bind variables defined. Can anyone please tell how can I achieve this. Also do I have to write a SQL or pl/sql statement.

    Hi Roshni Shankar,
    You can use substitution variable in case of SQL.
    SQL> select * from employees where emplployee_id = &emp_id;
    Enter value for emp_id: 100
    old   1: select * from employees where emplployee_id = &emp_id
    new   1: select * from employees where emplployee_id = 100If you want to put condition on varchar values then eighter provide values in single quotes or use single quote for substitution variable.
    SQL> select * from employees where last_name = &emp_name;
    Enter value for emp_name: 'King'
    old   1: select * from employees where last_name = &emp_name
    new   1: select * from employees where last_name = 'King'
    no rows selected
    SQL> select * from employees where last_name = '&e_name';
    Enter value for e_name: King
    old   1: select * from employees where last_name = '&e_name'
    new   1: select * from employees where last_name = 'King'In case of pl/sql you can pass values to procedure and you can use those values at run time.
    create or replace procedure test (p_emp_id number)
    as
       v_last_name      varchar2(100);
    begin
       select last_name
       into    v_last_name
       from  employees
       where employee_id = p_emp_id;
       dbms_output.put_line(p_emp_id ||'    ->    '||v_last_name);
    end;
    show errors
    SQL>exec test(100);
    SQL>exec test(101);Edited by: Gaurav Bhide on Oct 29, 2012 4:07 AM

  • I downloaded music to my iphone and when I went to go sync it up to itunes, I lost all of the songs purchased from that time until the previous time I backed it up. How do I recover these purchased songs that have been lost?

    I downloaded music to my iphone and when I went to go sync it up to itunes, I lost all of the songs purchased from that time until the previous time I backed it up. How do I recover these purchased songs that have been lost?

    All of your music should be in itunes on your computer.
    Select it to sync and sync.

  • How do i get back my playlists that have disappeared!!! they were backed up both on my laptop and the cloud

    how do i get back my playlists that have disappeared!!! they were backed up both on my laptop and the cloud

    Are you signed into itunes with your email address?  Purchases that are made through itunes are tied to the email address on your account.  If someone else logged in then your purchases wouldn't show. 
    When you go to the itunes store look at the black/gray bar at the top.  On the left is the email address that is signed in.  If it's incorrect just click on it and select "Sign Out."  When you sign back in all should be well.

  • How can I use TopLink for querys that have two and more tables?

    I use TopLink today, and I can use one table to query, but how can I use TopLink for querys that have two and more tables?
    Thank you for see and answer this question.

    You can write a custom SQL query and map it to an object as needed. You can also use the Toplink query language "anyOf" or "get" commands to map two tables as long as you map them as one to one (get command) or one to many (anyOf command) in the toplink mapping workbench.
    Zev.
    check out oracle.toplink.expressions.Expression in the 10.1.3 API

  • TS3899 How can i delete 3564 old emails that have come from the server on setting up my iphone in 1 easy move

    How do I delete 3654 old  emails that have been delivered when I started the new iphone?

    Log onto the server through your email providers web interface and delete them there.

  • How to select value of selectOneChoice

    Hello,
    First of all I want to describe what I want to do and then the preconditions for my case.
    What I want to do:
    I simply want a <selectOneChoice> Component which represents an enumeration of values.
    In database there is a column which has the value 'A' or 'P'.
    In the DataTransferObject´s mentioned below these values are represented with Character objects.
    If the DataTransferStructure mentioned below is loaded I want the <selectOneChoice> to display the current value originate from database.
    If I submit the DataTransferStructure (or DataTransferObject --> see below) I want that the selected value (of <selectOneChoice>) will be written to database.
    Preconditions:
    ADF BusinessComponenets are not used.
    Only ADF Faces and Bindings are used.
    I have defined a Bean wich executes functions over RMI on EJBs.
    This bean is used as DataControl to bind their return values to pages.
    It looks nearly like following class:
    public class FunctionalObjectServiceBean{
         public FunctionalObjectServiceBean() {
    public DataTransferStructure readObjectWithId(Long Id)
    throws Exception{
    DataTransferStructure has link to> DataTransferObject
    DataTransferObject has attribute> Character attributeA (with either value 'A' or 'P')
    I have defined a selectOneChoice in the jspx.
    DataTransferObjectAttr1 is an Iterator-Binding to the matching attribute in DataTransferObject.
    value="#{bindings.DataTransferObjectAttr1.inputValue}" should select the appropriate value originating from database on load.
    <af:selectOneChoice value="#{bindings.DataTransferObjectAttr1.inputValue}"
    label="#{bindings.DataTransferObjectAttr1.label}"
    required="#{bindings.DataTransferObjectAttr1.hints.mandatory}"
    shortDesc="#{bindings.DataTransferObjectAttr1.hints.tooltip}"
    id="soc1"
                                       valuePassThru="true">
    <af:selectItem label="Active" value="A" id="si1"/>
    <af:selectItem label="Passive" value="P" id="si2"/>
    </af:selectOneChoice>
    When I try to execute this example following errors occur:
    <FacesCtrlListBinding> <getInputValue> ADFv: In der Werteliste wurden keine gewählten Elemente gefunden, die mit dem Wert A des Typs java.lang.Character übereinstimmen.
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Erstellen eines Objekts vom Typ java.lang.Character aus Typ java.lang.String mit dem Wert A nicht möglich
    oracle.jbo.domain.DataCreationException: JBO-25009: Erstellen eines Objekts vom Typ java.lang.Character aus Typ java.lang.String mit dem Wert A nicht möglich
    Using converters has also no effect here.
    thanking you in anticipation

    I try to translate it in my words:
    <FacesCtrlListBinding> <getInputValue> In the value list no elements were found which match the value A with datatype java.lang.Character.
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: Creating object of type java.lang.Character from source type java.lang.String not possible.
    oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:java.lang.Character from type:java.lang.String with value: A.

  • How can i remove items from list that have been deleted when i click on them it keeps showing empty

    how can i remove items from the list that have been deleted when i click on them it keeps showing folder empty

    Actually, Reader SHOULD keep showing documents that no longer exist, I disagree. It's no big deal, and people will quickly realise why they can't open the file. They open more files, the old ones move off.
    The REASON why it should not check is that checking whether a file exists can take a long time when things aren't good. For instance if a file server goes down, or a memory card is unplugged. That in turn would mean delays opening the File menu, and I've seen some software that can sit there for several minutes. That would really give people something of which to complain...

  • How do I get my contacts back that have been lost

    How do I get contacts back that have been lost

    Sync them back from your computer using iTunes....like you should have been doing all along.

  • In a PrC, how to delete data from the PSA that have been loaded in Prcs Chn

    Hello,
    In a process chain, how can I delete the data from the PSA that have been loaded within that process chain. I don't want to delete data that belongs to other business units that use the same datasource.
    Thanks,
    Andre

    I dont think so you can achieve that, PSA is actually datasource dependent.
    One you load from a datasource to PSA.That is accesible by multiple DTPs if you have created so.
    As you said "I don't want to delete data that belongs to other business units that use the same datasource."
    If you delete the PSA, you may have to repull the data from source system again and if thats delta it wont work out.
    As said by above ppl you can include the "Delete PSA" in process chain but choose some 15 days buffer.
    Hope this helps.

  • How to find all Custom tables (transp) that have a custom transaction code?

    My client has asked us to provide a list of all Z (custom) tables and the associated transaction codes for maintaining them.
    I know I can manually do this with a Z* search in se11 and then do a where used on each table to find out if a view (transaction code) exists for the table - BUT THIS WOULD TAKE HOURS IF NOT DAYS TO DO AND BE LIABLE FOR HUMAN ERROR.
    Does anyone know the way we could code a search for this information (ABAP) and know what tables to use?
    Thanks.
    Scott

    Hi
    You can search in table TSTCP for custom tables that have a maintainance view and a transaction associated, which is a call to SM30. To do this, just select the table with TCODE starting with 'Z' and PARAM starting with '/*SM30'.
    But you can also have some Z tables updated by an module pool program. This is more complex to find, because you don't know if you simply have the field used in the screen for some other use in a transaction, or if it is in that screen just to update the table. In this case, you need to analyze each screen.But I hope the first tip help you to solve your problem.

  • How do I retrieve photo stream pictures that have disappeared?

    My photos seem to be disappearing from photo stream.
    Where are they going and how do I get them back?

    That's correct. Photostream only stores the most recent 1000 photos for up to 30 days. You are supposed to download a permanent copy to your computer for arhival purposes within that time.

  • How can I process pics in Lightroom that  have uploaded from my IPad?

    How can I process pics in Lightroom that I have uploaded from my IPad? I have managed to copy pics from the IPad into a file located in My Lightroom Pictures (and located on an external Hard Drive), which is where I put all my pictures. I an see the file in Finder and can even work with them as a Project in IPhoto, but nothing happens in Lightroom.

    Hi johnhb2,
    To import photos from your iPad into your Windows computer, I would suggest that you use the steps in this article -
    iOS: Import personal photos and videos from iOS devices to your computer
    http://support.apple.com/kb/HT4083
    Note that by default the pictures are placed in the “My Pictures” folder. Once imported you can see your photos there and use whatever application you want to view or manage them.
    Thanks for using Apple Support Communities.
    Best,
    Brett L

Maybe you are looking for