Another nested xmlagg

Hi folks,
I have the following query:
select xmlroot(
     xmlelement
          EMSData,
XMLForest(
v_DailyStartDate as "DailyStartDate",
v_WeeklyStartDate as "WeeklyStartDate",
v_MonthlyStartDate as "MonthlyStartDate"
          XMLAGG
               XMLELEMENT
                    year,
                    xmlattributes(calyear),
                    xmlagg
                         xmlelement
                              interval,
                              xmlattributes(intervalType as "Type",intervalValue as "Value"),
                              xmlelement
                                   data,
                                   xmlattributes(provider),
                                   xmlforest
                                        bytes,
                                        files
                         order by orderBy,intervalvalue desc
               order by calyear desc
     ), version '1.0').getClobVal() into l_xml
from myTable
group by calyear;
Which produces the following XML:
<?xml version="1.0"?>
<EMSDATA>
<DailyStartDate>30-SEP-11</DailyStartDate>
<WeeklyStartDate>01-OCT-08</WeeklyStartDate>
<MonthlyStartDate>01-JAN-02</MonthlyStartDate>
<YEAR CALYEAR="2011">
<INTERVAL Type="DAY" Value="333">
<DATA PROVIDER="ALPHA">
<BYTES>16734642488</BYTES>
<FILES>2333</FILES>
</DATA>
</INTERVAL>
<INTERVAL Type="DAY" Value="333">
<DATA PROVIDER="BETA">
<BYTES>2580914653</BYTES>
<FILES>8148</FILES>
</DATA>
</INTERVAL>
<INTERVAL Type="DAY" Value="332">
<DATA PROVIDER="ALPHA">
<BYTES>24516086977</BYTES>
<FILES>2315</FILES>
</DATA>
</INTERVAL>
<INTERVAL Type="DAY" Value="332">
<DATA PROVIDER="BETA">
<BYTES>1090547502078</BYTES>
<FILES>16548</FILES>
</DATA>
</INTERVAL>
</YEAR>
</EMSDATA>
What I really want the XML to look like is:
<?xml version="1.0"?>
<EMSDATA>
<DailyStartDate>30-SEP-11</DailyStartDate>
<WeeklyStartDate>01-OCT-08</WeeklyStartDate>
<MonthlyStartDate>01-JAN-02</MonthlyStartDate>
<YEAR CALYEAR="2011">
<INTERVAL Type="DAY" Value="333">
<DATA PROVIDER="ALPHA">
<BYTES>16734642488</BYTES>
<FILES>2333</FILES>
</DATA>
<DATA PROVIDER="BETA">
<BYTES>2580914653</BYTES>
<FILES>8148</FILES>
</DATA>
</INTERVAL>
<INTERVAL Type="DAY" Value="332">
<DATA PROVIDER="ALPHA">
<BYTES>24516086977</BYTES>
<FILES>2315</FILES>
</DATA>
<DATA PROVIDER="BETA">
<BYTES>1090547502078</BYTES>
<FILES>16548</FILES>
</DATA>
</INTERVAL>
</YEAR>
</EMSDATA>
I know it is something simple but I'm brain fried.
Please advise.
Best,
Nat

I'm thinking I need a nested select statement such as:
select xmlroot
     xmlelement
          EMSData,
          XMLForest
               v_DailyStartDate as "DailyStartDate",
               v_WeeklyStartDate as "WeeklyStartDate",
               v_MonthlyStartDate as "MonthlyStartDate"
          XMLAGG
               XMLELEMENT
                    year,
                    xmlattributes(calyear),
                         select
                         xmlagg
                              xmlelement
                                   interval,
                                   xmlattributes(intervalType as "Type",intervalValue as "Value"),
                                   xmlelement
                                        data,xmlattributes(provider),
                                        xmlelement
                                             "BYTES", bytes
                                        xmlelement
                                             "FILES",files
                         ) from mytable
               order by calyear desc
     version '1.0'
).getClobVal() into l_xml
from mytable
group by calyear;
However, when I try this Oracle just sits there. So, I decided to just try the nested sql itself to see the results. I ran the following:
declare
l_xml clob;
myFilename varchar2(50) := 'myTestXML';
v_ctx DBMS_XMLGen.ctxHandle;
xmldoc dbms_xmldom.DOMDocument;
begin
select
xmlroot(
                         xmlagg
                              xmlelement
                                   interval,
                                   xmlattributes(intervalType as "Type",intervalValue as "Value"),
                                   xmlelement
                                        data,xmlattributes(provider),
                                        xmlforest
                                             bytes,
                                             files
     version '1.0'
).getClobVal() into l_xml
from mytable;
xmldoc := dbms_xmldom.newDOMDocument(l_xml);
dbms_xmldom.writeToFile(xmldoc, 'ERR_DIR'||'/'||myFilename||'.xml');
dbms_xmldom.freeDocument(xmldoc);
end;
I get this error:
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00245: extra data after end of document
Error at line 8
ORA-06512: at "XDB.DBMS_XMLDOM", line 5345
ORA-06512: at "XDB.DBMS_XMLDOM", line 5370
ORA-06512: at "XDB.DBMS_XMLDOM", line 5290
ORA-06512: at line 42
Can anyone offer insight as to what I'm doing wrong.
Best,
Nat
Edited by: 899806 on Dec 1, 2011 9:15 AM
Edited by: 899806 on Dec 1, 2011 1:45 PM

Similar Messages

  • Issues animating symbol from another nested symbol instance

    Got quite the weird issue here regarding animating a symbol when mousing over and/or out of a symbol nested inside a symbol. You can see the example here. Rollover the word VISION. What happens is another symbol animates downward using JQuery's animate feature. Mousing out brings it back up.
    What's actually happening? The symbol at times animates up and down uncontrolably. It eventually stops, but not necessarily in the correct spot. Is it because of all the nesting? I'm trying to keep this as clean as possible which is why I'm nesting symbols. Much like I would a Flash comp way back when.
    Here's the mouseover code for btnVision:
    var myBtnVision = sym.getSymbol("btnVision");
    myBtnVision.play();
    try {
        var stage = sym.getComposition().getStage()
        stage.$("secVision").animate({top: 100}, { duration: 1000 });
    } catch (error) {
        if (console && console.error) console.error("An error occured: "+error.toString(), error);
    and here's the mouseout:
    var myBtnVision = sym.getSymbol("btnVision");
    myBtnVision.playReverse(500, false);
    try {
        var stage = sym.getComposition().getStage()
        stage.$("secVision").animate({top: 70}, { duration: 1000 });
    } catch (error) {
        if (console && console.error) console.error("An error occured: "+error.toString(), error);
    I have a dropbox file with the examples at the following:
    https://www.dropbox.com/s/ccgapo20p233h7z/rollover.zip

    Solved! It was just a little extra JQuery code that did the trick. Basically inserting a stop action.
    try {
        var stage = sym.getComposition().getStage()
        stage.$("secVision").stop().animate({top: 100}, { duration: 1000 });
    } catch (error) {
        if (console && console.error) console.error("An error occured: "+error.toString(), error);

  • PL/SQL insert nested table value into another nested table.

    Hi Guy
    I've created a table with nested table in and inserted some values. note: this is just an example the real table has more values inserted.
    REATE OR REPLACE TYPE tt_hours AS OBJECT(hours INTEGER, data NUMBER);
    CREATE OR REPLACE TYPE tt_day AS VARRAY(7) OF tt_hours;
    CREATE TABLE old_table
    DAY DATE,
    VALUE_hours tt_day
    INSERT INTO old_table
    (day, value_hours)
    VALUES
    (TO_DATE('01/06/2012 22:00:34'),
    tt_DAY(
    tt_hours(1,0.025727),
    tt_hours(2,0.012047),
    tt_hours(3,0.012857),
    tt_hours(4,0.012107),
    tt_hours(5,0.012849),
    tt_hours(6,0.01215),
    tt_hours(7,0.0129)))
    I've also created another table with same structure but with no value inserted.
    REATE OR REPLACE TYPE yy_hours AS OBJECT(thours INTEGER, tdata NUMBER);
    CREATE OR REPLACE TYPE yy_day AS VARRAY(7) OF yy_hours;
    CREATE TABLE new_table ( tDAY DATE, VALUE_thours yy_day )
    I run a select from statement which workout the average of data from old table by group.
    SELECT to_char(DAY, 'Day'), hours, AVG(data)
    FROM old_table n, TABLE(n.value_hours) v
    GROUP BY to_char(DAY, 'Day'), hours;
    How do I insert the result in new_table's ?

    I believe I said
    >
    You basically need to construct the INSERT statement just like you did manually for the first table.
    >
    and instead you used
    INSERT INTO new_table a (tday, t.hours, t.DATA) TABLE(a.value_thours) t This is what you did manually for the first table. Do you see TABLE (...) in here anywhere?
    INSERT INTO old_table
    (day, value_hours)
    VALUES
    (TO_DATE('01/06/2012 22:00:34'),
    tt_DAY(
    tt_hours(1,0.025727),
    tt_hours(2,0.012047),
    tt_hours(3,0.012857),
    tt_hours(4,0.012107),
    tt_hours(5,0.012849),
    tt_hours(6,0.01215),
    tt_hours(7,0.0129)))NO YOU DON'T - you used a tt_DAY constructor for the outer nested table and multiple tt_hours constructors for the inner nested table.
    You need to do the same thing in your INSERT query.

  • Another nested events question

    I have read the threads regarding this and still think I am able to get this working.  All I need is a simple calculation with a value change in a nested Event structure.  I know I can do it with a state machine and being crafty but would like to hear from others regarding getting this to work.  If not I will just go the other way.  I want to give this a shot though.
    Thanks
    LV2010 XP
    Attachments:
    nested_event.vi ‏16 KB

    tbob wrote:
    I don't think it is a good idea to have nested event structures.
    I would go a step further and say that event structures should never get nested and should never be in structures that can prevent them from reacting. Event cases should never contain interactive loops. There should never be more than one event structure anywhere in the same loop.
    Looking at your code, you have a complete misunderstanding of event structures:
    An event structure does NOT adhere to dataflow, meaning it will queue up an event even if dataflow prevents it from executing.
    There is no event that reacts to the stop button, so the VI cannot be stopped unless another event is fired too.
    Your event structures are set to lock the front panel until the event completes. While this is a recommended and good setting, it cannot work if the event case contains intereactive code that needs user interaction to proceed. Once your outer loop fires, the front panel is locked. Thus the inner event can never fire. Since the inner loop needs complete before the outer even can complete, nothing further can happen.
    All you need is a single outer loop containing a single event structure, possibly with several event cases. The shift register belongs into the outer loop. Don't forget to utilize the timeout event. Simplify!!
    LabVIEW Champion . Do more with less code and in less time .

  • Embed one project into another (nesting)

    One feature that I would love to have in a slide show software is the ability to embed one project into another. Is this a feature of Keynote?
    Here is where it would be handy:
    I was in a band an we needed to put all of the lyrics for our original songs up on the big screen when we were playing. Neither or "set list" nor order was finalized, but was going to be 10 songs out of a possible 15. We wouldn't know until only minutes before going on. Since I play bass and had to be on stage, I had to have it simple enough for a 12 year old kid to run the presentation.
    I could figure no way that I could possibly cut and paste and remove all the slides into the correct order right before going on stage. I worried about this for 2 days and figured out what to do.
    I used Adobe Indesign and set each song up as it's own file. Then using InDesign's build book feature, I linked all the files into a book file. 5 minutes before the show, I resorted the chapters in the book file, and exported to PDF. I ran the PDF in full screen mode and the 12 year old girl just sat there and hit the spacebar for our songs. It worked perfectly.
    Is there a way that I can do separate projects in Keynote and assemble them quickly like I did with InDesign and Acrobat?
    Thanks,
    Kirk

    OK, if you don't want them all in the same Keynote file so you can hyperlink around the file to the desired slide numbers, then try this.
    Create your Keynote of a song. Name it easily so you can find it easily. At the end of each song keynote, put a "Return to Index" and hyperlink it to the Keynote with the program. On the program slide you can Name the songs, Song 1, Song 2, Song 3, and Song 4. Of course, you can enter the name of the song in the program slide. If you use the generic name the process of creating the hyperlink is an easy one (it's even easy if you enter the name of the song you want). If you keep all song Keynotes in the same folder with the index, it's a matter of selecting the file title as the Keynote slideshow to hyperlink to. So you can change the four songs in a program presentation in about 2 minutes max. so you get:
    File name: Agenda
    Modern Church of God
    Sunday, October 10, 2010
    Reverent I M. Religious, presiding
    10:30 am
    Call to order
    Song 1 (hyperlink to "Rock of Ages")
    Processional
    Prayer
    Song 2 (hyperlink to "Bringing in the Sheaves")
    Announcements
    Reading
    Song 2 (hyperlink to "Ave Maria")
    Sermon, "How do we maximize our resources."
    Song 3 ((hyperlink to "Jesus Loves Me")
    Digressional
    Song 4 (Oh, What I friend we have in Jesus)
    At the end of the Rock of Ages lyrics Place
    "Return to Program" and hyperlink to "Agenda"
    For the next week, "Agenda 10/17" Change the hyperlinks for songs to the new selection of keynotes you have created earlier. It will take about a minute or two to make the changes. You do each one by clicking the Enable hyperlink selection box when one of the song references is selected. The pull the pull down menu to Keynote Slideshow. A box will open. Go to your folder with all song and agenda files. Select the song keynote you want to access with the click, when you select the song file and click "Open" your connection is made. You then project the agenda file on Sunday morning. When you reach song 1, you click on it and the song's keynote comes up. When the song is finished, click on Return to Program and your program Keynote is back up.
    The only time consumer in this process is entering the song lyrics into their own keynote files. If you have somewhere to copy and paste the words, then it's easy. The mechanics of creating the weekly connection is very easy. Once you have your resources created, preparation time for a Sunday program will be only a long as it takes you to enter the planned agenda components.

  • How to select data from one nested table and into another nested table

    create or replace
    TYPE ctxt_code_rec as object
    ctxt_header varchar2(10),
    header_description varchar2(300),
    status varchar2(30),
    adjacent_code varchar2(300),
    adjacent_desc Varchar2(400),
    adjacent_flag varchar2(4000),
    adjacent_text_href varchar2(4000)
    create or replace
    type ctxt_code_table as table of CTXT_CODE_REC
    d_table ctxt_code_table ;
    v_tab ctxt_code_table ;
    Iam trying to select data from d_table to v_tab
    using and bulk collect into
    select m.*
    bulk collect into p_code_result
    from table(l_loop_diag_code_table1)m
    order by 1;
    Receiving error:
    ora 94007 : not enoughvalues
    Could you please let me know how to solve it?
    Thanks,
    in advance

    >
    create or replace
    TYPE ctxt_code_rec as object
    ctxt_header varchar2(10),
    header_description varchar2(300),
    status varchar2(30),
    adjacent_code varchar2(300),
    adjacent_desc Varchar2(400),
    adjacent_flag varchar2(4000),
    adjacent_text_href varchar2(4000)
    create or replace
    type ctxt_code_table as table of CTXT_CODE_REC
    d_table ctxt_code_table ;
    v_tab ctxt_code_table ;
    Iam trying to select data from d_table to v_tab
    using and bulk collect into
    select m.*
    bulk collect into p_code_result
    from table(l_loop_diag_code_table1)m
    order by 1;
    Receiving error:
    ora 94007 : not enoughvalues
    Could you please let me know how to solve it?
    >
    Not unless you provide the code you are actually using.
    There is no definition of 'p_code_result' in your post and you say you 'trying to select data from d_table' but there is no code that loads 'd_table' in what you posted.
    And the SELECT query you posted actuall selects from an object named 'l_loop_idag_code_table1' which isn't mentioned in your code.
    Post the actual code you are using and all of the structures being used.
    Also explain why you even need to use nested tables and PL/SQL for whatever it is you are really doing.

  • StrutsTags/JSP or... Another Nesting Newbie

    I am having trouble teaching myself Struts taglib syntax/JSP coding and I am stuck on a classic nested object JSP/Struts syntax problem...
    Can you explain the errors in the following snippet?
    Background: The form associated with the jsp contains a property called "electronicDocDetails" which is an ArrayList of "DisplayFieldList" objects. DisplayFieldList objects have a list of "DisplayField" objects that have displayNames and values, etc..
    The Jsp validation results in the error "Jsp Translate: The Attribute value has no value"
    Also, I've tried writing this using only 'logic' and 'bean' tags instead of using nesting and I get the same error. (Yes, I've read two Struts books and the Apache Struts website documentation :-( ).
    <BODY>
    <html:form action="/CaseInquiryDetails">
    <nested:iterate property="electronicDocDetails" >
         <TR align="center">
    <TD align="center" colspan="4" class="MssTDFormLabel">
                        <bean:message key="label.caseinquirydetails.electronicdoc"/></TD>
         </TR>
              <nested:iterate property="fieldList" >
              <TR align="center">
                   <TD align="left" class="MssTDFormLabel" colspan="1">
                        <nested:write property="displayName" />
                   </TD>
                   <nested:equal property="displayName" value="NAME" >
                        <TD align="left" class="MssTDFormLabel" colspan="3">
    <%-- ERROR ON THE FOLLOWING LINE with the first '<bean:write>' --%>     
    <%-- "Jsp Translate: The Attribute value has no value" --%>
    <html:link href="<%=prefix%><bean:write property="value" />">
                        <bean:write property="value" />
    </html:link>
                        </TD>
                   </nested:equal>
                   <nested:notEqual property="displayName" value="Name" >                                   
                        <TD align="left" class="MssTDFormResult" colspan="3">
                             <bean:write property="value" />
                        </TD>
                   </nested:notEqual>
              </TR>
              </nested:iterate>
         </nested:iterate>
    TIA...
    jrh

    The "nested" tags are for use in navigating bean hierarchies.
    NOT for nesting tags.
    ie you use them like this (pulling an example from the documentation: http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-nested.html
    //Instead of this:
    <nested:write property="myNestedLevel.propertyOne" />
    <nested:write property="myNestedLevel.propertyTwo" />
    <nested:write property="myNestedLevel.propertyThree" />
    //You can write this:
    <nested:nest property="myNestedLevel" >
      <nested:write property="propertyOne" />
      <nested:write property="propertyTwo" />
      <nested:write property="propertyThree" />
    </nested:nest >You should just be using the regular "logic" and "bean" tags
    Your main problem is here:
    <html:link href="<%=prefix%><bean:write property="value" />">
    You can't nest custom tags as attributes to other custom tags.
    You can only use expressions.
    Try declaring a temp variable with that value like this:
    <bean:define id="tempURL"><%=prefix%><bean:write property="value" /></bean:define>
    <html:link href="<%= tempURL %>">
      <bean:write property="value" />
    </html:link>

  • Query help,  Percentages / ratio to reports / nests

    Hi
    I have a query that returns data like this
    D_NO POINTS COUNT_POINTS ID_COUNT
    4002 L_T_69 12 282
    4219 L_T_69 1 151
    4228 L_T_69 18 193
    4229 L_T_69 7 181
    4230 L_T_69 0 197
    I need to also output a column that works out a percentage of count_points and Id_count. e.g 12/282 * 100 = 4.2
    I had a try with ratio to reports function but no joy for me. I think i need to add in
    another nested select or something but what i was trying wasnt working.
    Can anyone help.
    here is the query so far
    SELECT D_NO,
    GROUPS.POINTS,
    DECODE(GROUPS.POINTS, 'L_T_69' , L_T_69) AS COUNT_POINTS,
    ID_COUNT
    FROM
         (SELECT D_NO,
         Count (CASE WHEN VERBAL <= 69 THEN 1
              END) AS L_T_69,
         COUNT(ID_NUMBER) AS ID_COUNT
         FROM TBL_1
         WHERE VERBAL IS NOT NULL
         group by D_NO)
    TBL_1,
    ( SELECT 'L_T_69' POINTS FROM DUAL )GROUPS
    thank you

    Not sure if this is what you're looking for but it may give you some clues:
    select object_type
          ,has_a_c
          ,type_total
          ,round(100 * (has_a_c / type_total),2) ratio
    from
       select object_type
             ,sum (case when instr(object_name,'C') <> 0 then 1
                        else 0
                   end) has_a_c
             ,count(*) type_total
       from   all_objects
       group by object_type
    OBJECT_TYPE          HAS_A_C   TYPE_TOTAL   RATIO
    CONSUMER GROUP             1            2      50
    EVALUATION CONTEXT         1            1     100
    FUNCTION                  50          113   44.25
    INDEX                      7           20      35
    LIBRARY                    0            2       0
    OPERATOR                   1            2      50
    PACKAGE                  500         1158   43.18
    PACKAGE BODY             487         1126   43.25
    PROCEDURE                 54           86   62.79
    SEQUENCE                  62          116   53.45
    SYNONYM                 1060         2298   46.13
    TABLE                    365          721   50.62
    TABLE PARTITION           15           15     100
    TYPE                     104          272   38.24
    VIEW                     834         1896   43.99
    15 rows selected.

  • Find/Change problems within a nested style?

    I have a problem with Find/Change (in both CS4 and CS5) not recognizing text within its “find” parameters when text that fits those parameters is part of a nested style. I want to find any instance of italic in the text, regardless of what paragraph or character style it is, but F/C only intermittently finds italics, both within and without that text existing in a nested style. Has anyone come across this issue?
    There is NOTHING different about the text that is recognized by F/C–or not recognized–that shows up in any of the panels or palettes. There are no font conflicts. I’ve replaced prefs and saved data files. If I go into the character palette and change the italic portion of the nested style to “italic” character style (it shows up in character palette as [none], even though it has a nested style), then F/C finds it for sure; but if I don’t do that, then F/C will sometimes find it, and sometimes not, and sometimes in one instance and not in another! There is no hidden formatting that shows up in story editor. I remade another nested para style with the same formatting but with varying results! Help… I’ve tried everything.

    I have a problem with Find/Change (in both CS4 and CS5) not recognizing text within its “find” parameters when text that fits those parameters is part of a nested style. I want to find any instance of italic in the text, regardless of what paragraph or character style it is, but F/C only intermittently finds italics, both within and without that text existing in a nested style. Has anyone come across this issue?
    There is NOTHING different about the text that is recognized by F/C–or not recognized–that shows up in any of the panels or palettes. There are no font conflicts. I’ve replaced prefs and saved data files. If I go into the character palette and change the italic portion of the nested style to “italic” character style (it shows up in character palette as [none], even though it has a nested style), then F/C finds it for sure; but if I don’t do that, then F/C will sometimes find it, and sometimes not, and sometimes in one instance and not in another! There is no hidden formatting that shows up in story editor. I remade another nested para style with the same formatting but with varying results! Help… I’ve tried everything.

  • Multi-level nested tables for repeatable XML Elements

    Hi there,
    Suppose we have a XML Schema „ASchema“ like this (XMLDB schema annotations are left out for simplicity):
    <xs:schema xmlns:xs=" .... " />
    <xs:element name=“A“>
         <xs:complexType>
              <xs:sequence>
                   <xs:element name=“B“ maxOccurs=“unbounded“/>
                        <xs:complexType>
                             <xs:sequence>
                                  <xs:element name = “C“ maxOccurs=“unbounded“/>
                             </xs:sequence>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
    </xs:element>
    </xs:schema>
    After registering this schema in Oracle, I can define a table like this:
    CREATE TABLE ATable
    id NUMBER,
    doc XMLTYPE
    XMLTYPE COLUMN doc
    XMLSCHEMA “ASchema“ ELEMENT “A“
    VARARRAY doc.“XMLDATA“.“B“ STORE AS TABLE “BTable“
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
    This creates a nested table "BTable" within the table "ATable". So far so good, I can use this nested table to gain faster access on every possible subelement of Element B when I set an appropriate index.
    I now want to create another nested table for element “C“ like this:
    DROP TABLE ATable;
    CREATE TABLE ATable
    id NUMBER,
    doc XMLTYPE
    XMLTYPE COLUMN doc
    XMLSCHEMA “ASchema“ ELEMENT “A“
    VARARRAY doc.“XMLDATA“.“B“ STORE AS TABLE “BTable“
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
    VARARRAY doc.“XMLDATA“.“B“.“C“ STORE AS TABLE “CTable“
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
    But this statement fails with the error message something like „ ... no such attribute ... „
    And here's my question: is it possible to create nested tables for repeatable XML Elements that are subelements of other repeatable XML Elements ? And if so, how can I do it ?
    Thank you very much in advance
    Jan

    Found a (partial) solution myself:
    If you add the attribute xdb:storeVarrayAsTable="true" to the root element of the XML schema, Oracle XMLDB generates nested tables for all repeatable XML Elements while registering the XML schema.
    Unfortunately, the names of these nested tables are system-generated, hence it's a bit uncomfortable to set indices on them. You can find out the names of these nested tables as follows:
    select table_name, parent_table_name, parent_table_column from user_nested_tables;
    Further information on that subject is supplied in the following thread:
    Re: default tables for elements with maxoccurs > 1
    It would be nice if there was a way to name the generated nested tables via appropriate XMLDB schema annotations.
    regards
    Jan

  • Data pump import error with nested tables

    So the problem is somewhat long :)
    Actually the problems are two - why and how oracle are treating OO concept and why data pump doesn't work?
    So scenario for the 1st one:
    1) there is object type h1 and table of h1
    2) there is unrelated object type row_text and table of row_text
    3) there is object type h2 under h1 with attribute as table of row_text
    4) there is table tab1 with column b with data type as table of h1. Of course column b is stored as nested table.
    So how do you think - how many nested tables Oracle will create? The correct answer is 2. One explicitly defined and one hidden with system
    generated name for the type h2 which is under type h1. So the question is WHY? Why if I create an instance of supertype Oracle tries to adapt
    it for the subtype as well? Even more if I create another subtype h3 under h1 another hidden nested table appears.
    This was the first part.
    The second part is - if I do schema export and try to import it in another schema I got error saying that oracle failed to create storage table for
    nested table column b. So the second question is - if Oracle has created such a mess with hidden nested tables how to import/export to another
    schema?
    Ok and here is test case to demonstrate problems above:
    -- creating type h1 and table of it
    SQL> create or replace type h1 as object (a number)
      2  not final;
      3  /
    Type created.
    SQL> create or replace type tbl_h1 as table of h1;
      2  /
    Type created.
    -- creating type row_text and table of it
    SQL> create or replace type row_text as object (
      2    txt varchar2(100))
      3  not final;
      4  /
    Type created.
    SQL> create or replace type tbl_row_text as table of row_text;
      2  /
    Type created.
    -- creating type h2 as subtype of h1
    SQL> create or replace type h2 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    SQL> create table tab1 (a number, b tbl_h1)
      2  nested table b
      3  store as tab1_nested;
    Table created.
    -- so we have 2 nested tables now
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    -- another subtype of t1
    SQL> create or replace type h3 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    -- plus another nested table
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    SYSNTfsl/+pz03+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    SQL> desc "SYSNTfsl/+pzu3+jgQAB/AQB27g=="
    Name                                      Null?    Type
    TXT                                                VARCHAR2(100)OK let it be and now I'm trying to export and import in another schema:
    [oracle@xxx]$ expdp gints/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints.log
    Export: Release 11.2.0.1.0 - Production on Thu Feb 4 22:32:48 2010
    <irrelevant rows skipped>
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    . . exported "GINTS"."TAB1"                                  0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pz03+jgQAB/AQB27g=="         0 KB       0 rows
    . . exported "GINTS"."TAB1_NESTED"                           0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pzu3+jgQAB/AQB27g=="         0 KB       0 rows
    Master table "GINTS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    ******************************************************************************And now import. In order to create types transformation of OIDs is applied and also remap_schema
    Although it fails to create the table.
    [oracle@xxx]$ impdp gints1/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Import: Release 11.2.0.1.0 - Production on Thu Feb 4 22:41:48 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Release 11.2.0.1.0 - Production
    Master table "GINTS1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "GINTS1"."SYS_IMPORT_FULL_01":  gints1/********@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Processing object type SCHEMA_EXPORT/USER
    ORA-31684: Object type USER:"GINTS1" already exists
    Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    ORA-39083: Object type TABLE:"GINTS1"."TAB1" failed to create with error:
    ORA-02320: failure in creating storage table for nested table column B
    ORA-00904: : invalid identifier
    Failing sql is:
    CREATE TABLE "GINTS1"."TAB1" ("A" NUMBER, "B" "GINTS1"."TBL_H1" ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 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_
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Job "GINTS1"."SYS_IMPORT_FULL_01" completed with 4 error(s) at 22:41:52So any idea how to make export/import of such tables?
    TIA
    Gints

    Tom Kyte has said it repeatedly ... I will repeat it here for you.
    The fact that Oracle allows you to build object tables is not an indication that you should.
    Store your data relationally and build object_views on top of them.
    http://www.morganslibrary.org/reference/object_views.html
    If you model properly, and store properly, you don' have any issues.

  • Problems with Whitespace using nested tables from eclipse dtp oracle plugin

    Hi,
    sending from eclipse to oracle xe fails if whitespace is used:
    Example1: Nested table in nested table
    adress_table_typ has another nested table in it
    that works
    CREATE TABLE x (
    i INTEGER PRIMARY KEY,
    adressen adress_table_typ
    ) NESTED TABLE adressen STORE AS adressen_nt (NESTED TABLE tels STORE AS tels_nt);
    inserting a newline fails
    CREATE TABLE x (
    i INTEGER PRIMARY KEY,
    adressen adress_table_typ
    ) NESTED TABLE adressen STORE AS adressen_nt
    (NESTED TABLE tels STORE AS tels_nt);
    Example2:
    Two nested tables
    CREATE TABLE x (
    i INT PRIMARY KEY,
    l_table_typ,
    m_table_typ
    ) NESTED TABLE laptops STORE AS laptop_nt NESTED TABLE interessen STORE AS interessen_nt;
    and then an insert
    INSERT INTO x VALUES (123456,
    l_typ(laptop_typ('123', 'netop'),
    laptop_typ('234', 'thinkpad'),     
    laptop_typ('345', 'iBook')),
    m_typ('a', 'b', 'c')
    which fails. Note that the INSERT works when copy&pasted to sqlplus. It also works if there is
    just one nested table.
    Am I doing somethig wrong or is this a bug in the eclipse data tools plugin?
    Regards
    - Peter
    PS; It is rather difficult to insert whitespace in that forum editor. Any possibility to have ascii?
    For a "whitespace" question rather important...

    A bit of an update on the original post. I was playing around with the plug-in xml file (e.g. eclipse\plugins\org.eclipse.jst.server.generic.oc4j_1.5.100.v20070608\buildfiles\oracle.10.1.3.xml). I changed the following from "deploy" to "redeploy" and it seems to be working once the applicatoin is initial deployed. Of course, I have to change it back to "deploy" if it is the first time the application is being deployed. However; I would still would like to resolve this if there is something out there that fixes this problem. Or if everything points to an enviornment problem, I can continue to play with it.
    <target name="deploy.j2ee.ear" depends="check.skip.ear.deploy" unless="skip.deploy">
    <antcall target="package.module.ear"/>
    <oracle:redeploy
    deployerUri="${deployer.uri}"
    userId="${oc4j.admin.user}"
    password="${oc4j.admin.password}"
    file="${server.publish.dir}/${module.name}.ear"
    deploymentName="${module.name}"
    bindAllWebApps="${oc4j.bind.website}"/>
    </target>

  • Union all-distinct and remove duplicates from nested table?

    Hi all,
    I need a select that will bulk collect some data in my nested table.
    I have two tables from which I need to select all the accounts only once.(remove duplicates).
    Tried to search on the forum...but no luck.
    I have a table with one column:
    create table a1(account_no number);
    and a second table with 3 columns.
    create table a2 (account_no number, name number, desc varchar2 (100));
    I have a nested table like:
    table of a2%rowtype;
    Can I select from this two table in one select and put in my nested table just one row per account?
    if a I have in a 2a row like :
    1 'test' 'test2'
    2 aaaa aa
    and in a1 a row like:
    1
    I want to put in my nested table just (1, null,null and 2,aaaa, aa)) or (1,test,test2 and 2,aaaa, aa). it does no matter what row from those two I insert.
    Second question:
    If I use:
    BANNER
    Oracle9i Release 9.2.0.5.0 - Production
    PL/SQL Release 9.2.0.5.0 - Production
    CORE     9.2.0.6.0     Production
    TNS for 32-bit Windows: Version 9.2.0.5.0 - Production
    NLSRTL Version 9.2.0.5.0 - Production
    SQL>
    what is the best solution to remove duplicates from a neste table like mine?
    I thought that I can build another nested table and loop in my first nt and for each row I check in there was the same account in previous lines.
    it will be like:
    for i in 1....nt_first.count loop
    for j in 1..i loop
        --check if my line was in previous lines. if it was...do not move it in my second collection
    end loop;it is this best option in oracle 9i?

    I have a table with one column:
    create table a1(account_no number);
    and a second table with 3 columns.
    create table a2 (account_no number, name number, desc varchar2 (100));
    all I need are the accounts. the rest ar extra data
    that I can ignore in this step. But if it is
    available, it is ok to use it.
    using one select in this case is is much better that
    trying to remove duplicates parsing some nested table
    with FOR many times?
    Thankshi,
    try to use union. Union automatically removes duplicates between two or more tables.
    with t1 AS
           (select '3300000' account_no FROM DUAL UNION
            select '6500000' account_no FROM DUAL union
            select '6500000' account_no FROM DUAL union
            select '6500000' account_no FROM DUAL union
            select '6500000' account_no FROM DUAL
           select * from t1ACCOUNT_NO
    3300000
    6500000

  • Is it possible to "nest" iWeb pages?

    Is it possible to "nest" iWeb pages?

    It depends on what you mean by nesting. If you want to have Page A and then have several daughter pages  A1, A2, A3, etc. that are only accessable from Page A you can do that.
    Create pages A1, A2, A3, etc. and remove them from the navbar in the Inspector/Page/Page pane:
    Click to view full size
    The create a secondary navbar on Page A linking to the daughter pages: Text Based Navbar
    On the daugher pages you can remove the standard navbar and only have a link back to the parent page, Page A, if you'd like. Those daughter pages will be accessable only from Page A.
    If you want another nested layer you can do the same with Page A1 - create daughter pages to it.
    OT

  • Nested table type in object view on 8.1.7

    Object views seem to be the ideal way to deliver XML datagrams from database queries with nested data.
    I need to create a datagram that contains nested data within another nested set of data eg. a family has many people, each person may have many hobbies.
    The following code taken from Oracle documentation would create the Types I need, but this does not work on 8.1.7 (gets PLS-00534 error). Can someone advise if nested tables within a table type is a new Oracle 9 feature?
    CREATE TYPE project_t AS OBJECT
    ( projname VARHCAR2(20)
    , mgr VARHCAR2(20));
    CREATE TYPE nt_project_t AS TABLE OF project_t;
    CREATE TYPE emp_t AS OBJECT
    ( ename VARCHAR2(20)
    , salary NUMBER
    , deptname VARHCAR2(20)
    , projects nt_project_t);
    CREATE TYPE nt_emp_t AS TABLE OF emp_t;
    CREATE TYPE dept_t AS OBJECT
    ( deptno NUMBER
    , deptname VARHCAR2(20)
    , emps nt_emp_t);
    Thks, Matt. (asked same question in XML forum but maybe more appropriate here).
    null

    Matthew,
    Value-based multi-level collections, such as the one you have here, were not supported in 8.1.7. You have two choices:
    1. Upgrade to 9i to take advantage of value-based multi-level collections (see http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88878/adobjbas.htm#462243), type inheritance, type evolution and other new features.
    2. Use REFs in 8.1.7 to build a reference-based multi-level collections (see http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a76976/adobjdes.htm#446229).
    Regards,
    Geoff

Maybe you are looking for