Modifying child node instances in the foreach loop

Dear All,
I have implemented a custom BO with a child node. On executing an action on the root node, i want to loop through the associated child nodes and create an SAP standard BO instance for every child node instance.
I then want to associate the ID of the standard BO created to a field in the child node.How do i modify the child node instance in this loop?
Any pointers would be really appreciated.
Thanks a lot for your help.
- Kavya

Hello Kavya,
First you want to lopo over all child nodes
     ( var myChild in this.Child ) {
Then you create the standard BO
     customer = Customer.Create();
Now assign the InternalID to your Child ID
     myChild.ChildId = customer.InternalID;
HTH,
    Horst

Similar Messages

  • Does this child node add to the treemodel?

    i've create a treemodel using a list of rootNodes.
    i just wonder if when i create the treemodel and also keep a refference to the rootNodes list.then i add a new node to one of rootnodes as a child.
    so,here is the question:does this child node add to the treemodel?

    i've figure out.it is in memory

  • UnPivot in the foreach loop container

    Hi
    I would like to "unpivot" SEQUENTIALLY each row in a table
    Before the pivot task in the foreach loop container how to read sequentially each row ?
    1/ from a PK ?
    2/ from parameters with a WHERE field1 = ? and field2 = ? and field3=?....
    These parameters have been set up prevoiouly in the loop
    3/ Others ? ...
    Thx for your help

    Hi Gilles,
    To achieve your goal, you can simply use the Unpivot Transformation or UNPIVOT statement in T-SQL.
    If you want to use Unpivot Transform, it should be configured as follows:
    If you want to use T-SQL, the query is like below:
    SELECT u.Name, u.Category
    FROM [dbo].[MyTable]
    UNPIVOT
    (Name for Category in (Field1, Field2, Field3)) u
    References:
    http://dinesql.blogspot.in/2011/08/pivot-and-unpivot-integration-services.html
    http://technet.microsoft.com/en-us/library/ms177410(v=sql.105).aspx
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • Using assign-activity:Append to append child nodes in XML-tree within loop

    I would like to produce an XML looking something like this (just an example):
    <Customer>
    <Name>Tom</Name>
    <Invoices>
    <Invoice>
    <InvoiceData>.....</InvoiceData>
    </Invoice>
    <Invoice>
    <InvoiceData>.....</InvoiceData>
    </Invoice>
    </Invoices>
    </Customer>
    For different reasons (composite PK's in DB etc) I have to first get the Customer-data, and then get each Invoice for that customer.
    Then I have to loop the Invoices and append each Invoice-node to the XML, ending up with the whole thing when the loop is finished.
    This should be pretty simple (I guess), and I have tried different variations of the Append (assign activity), but everytime I end up with only the last Invoice-node.
    I can see in the Flow-window of the BPEL Console that it is not the same Invoice-node I'm appending within the loop-iterations, so that can not be the case in any way.
    In other words it seems to copy instead of appending.
    What is wrong ?
    Is this a bug in the Append function ?
    Any suggestions to other approaches that might work ? (I have to use the loop to get 1 and 1 Invoice-node though, and in that way put the whole XML together in some way)
    Edited by: user1694182 on 09.okt.2008 05:08

    Thank you for your answer.
    After taking your "debugging"-suggestions at hand and running some tests, I can now see that it gets appended in some way, but not correctly.
    1st LOOP ROUND:
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>308</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    Correct so far.
    2nd LOOP ROUND:
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>322</measurePointId>...</measurePoint>
    <measurePoint><measurePointId>322</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    So now it appends the new measurepoint, but overwrites the 1st as well... Strange..
    3rd LOOP ROUND (last round):
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>382</measurePointId>...</measurePoint>
    <measurePoint><measurePointId>382</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    So suddenly the same Append doesn't append, but overwrites the 2 I had with the new measurepoint...Strange...
    WHAT I DO IN MORE DETAIL:
    1: Assign(copy) the whole XML in the 1st loop round. (Copy - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
    2: Within each loop round I collect the whole XML with just 1 measurePoint (TransformActivity - FROM: DBAdapter-output - TO: submitInstallation_InputVariable).
    3: Within each loop round I then append the new measurePoint (collected in step 2) to the measurePoints-node. (Append - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
    PS! I can see in the BPEL Console that it is a new measurePoint that gets collected in step 2, and just 1 node.
    Help/tips on this is very appreciated ! :-)
    Edited by: user1694182 on 14.okt.2008 00:57

  • SSIS and the FOREACH LOOP and no Connection String Property

    Hello!
    I am tryng to set up a Foreach Loop. I have everything configured properly but the Expression Property does not have Connection String in it as is shown in several examples. Anyone have any suggestions?
    Thanks
    Mike
    Mike Kiser

    Mike,
    I think you are confusing Flat file connection manager's conn string property with for each loop (FELC). As Arthur said, FELC doesn't have any conn strings !!!. As per xample, you have to got to properties of the flat file conn manager (highlight FF conn
    manager and press F4). Then hit eliipses and there you'll see connecting string property in dropdown. This is explained in the link you are seeing !!!!
    Thanks, hsbal

  • The ForEach Loop Enumerator is Empty - SSIS Error when executing through CMD via VBA

    I am currently working on a SSIS package that is to be triggered through CMD via VBA (Access). All that the package does is read a bunch of files from a folder and upload them into a table in SQL Server. The tricky part comes is that this folder location from
    which the package is to read the files is dynamic.
    I figured out a way to make it dynamic, by using variables
    I have used the following variables:
    "Directory" against DIRECTORY in COLLECTION>>EXPRESSIONS in the ForEachfile Enumerator,
    "FilePath" (With Index 0) in the Variable Mappings
    PROBLEM : As the final link in the chain, I have used following to be triggered from VBA
    dtexec \f "C:\Desktop\SSISAppend.dtsx" /Set "\Package.Variables[User::Directory].Property[Value];C:\Desktop\AppendFiles"
    When I try to execute the package using the above command, it gives out the error
    Code : 0x8001C004
    Description: The For Each File Enumerator is empty. The For Each File enumerator did not find any files that meatched the file pattern, or the specified directory was empty.
    But, when I run the package from MS VisualStudio 2008, the package runs fine, takes the location of the file assigned to the variable "Directory". 
    All help is appreciated

    Where are you executing the package from? You're giving an aboslute path so this will work only if package as well as the folder is in the same machine from which you execute the above code. Otherwise you need to use UNC path.
    Another thing to check is what login is executing the command and you need to ensure it does have access to the directoty path as well as to the path where package resides.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to bypass errors in the control flow in a foreach loop in SSIS?

    Hi All,
    Can anyone please get me through the solution for the below scenario:
     - I have multiple XML files existing in the source system from where I need to read the data from each XML, validate and pull to staging database. 
    - So, to read the XML files from source, I have a foreach loop which will get the XML files from the source folder one by one and executes.
    - There are multiple data flow tasks, script tasks, SQL tasks etc in the foreach loop to validate the business requirements.
    Question: If there is an error in any of the component in foreach loop, it should log the error, come out of the loop from that point and pick up the next file with out stopping the execution. How can I achieve this?
    Thanks,
    Sri

    Hi Sri,
    According to your description, when there is an error in any of the component in Foreach Loop Container, you want to continue processing rest of the loop after recording the error file details.
    To achieve your requirement, the first thing you need to do is create an OnError event handler for the Data Flow (or any other child executable). Once the event handler is created show the system variables in the variables window, locate the Propagate variable
    and set it to false.
    For more details, please refer to the following two blogs:
    http://www.codeproject.com/Articles/384690/In-SSIS-how-to-continue-a-for-each-loop-container
    http://visakhm.blogspot.in/2013/03/error-handling-in-ssis-loops.html
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • XML Node Selection in Foreach Loop

    Good Morning,
    I am just building up my first SSIS-package which uses a web service as data source. Now, that I managed the data to be processed using a Foreach Loop, I am wondering how the loop reacts when the sequence of teh nodes changes, or a certain node is not present.
    In the "Foreach Loop Editor - Variable Mappings" I have mapped the variables (as they are at the moment) to the certain index (as they appear at the moment), but again: what if an additional nodes comes in? Isn't there a way to explicitly tell the
    system to set variable ABC with node ABC, DEF with node DEF and so on... 

    Good Morning,
    am copying in the reply, I receive from the web service which is then stored in the variable:
    <?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n
    <DataSet>\r\n
    <xs:schema id=\"NewDataSet\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\r\n
    <xs:element name=\"NewDataSet\" msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\">\r\n
    <xs:complexType>\r\n
    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\r\n
    <xs:element name=\"FLT\">\r\n
    <xs:complexType>\r\n
    <xs:sequence>\r\n
    <xs:element name=\"CARRIER\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"FLIGHT\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"DEP\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"DES\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"DATE_LOC\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"ETD_LOC\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"ETA_LOC\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"DATE_UTC\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"ETD_UTC\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"ETA_UTC\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"PAX_C\" type=\"xs:short\" minOccurs=\"0\" />\r\n
    <xs:element name=\"PAX_Y\" type=\"xs:short\" minOccurs=\"0\" />\r\n
    <xs:element name=\"SEAT_C\" type=\"xs:short\" minOccurs=\"0\" />\r\n
    <xs:element name=\"SEAT_Y\" type=\"xs:short\" minOccurs=\"0\" />\r\n
    <xs:element name=\"PAX_EX\" type=\"xs:short\" default=\"0\" minOccurs=\"0\" />\r\n
    <xs:element name=\"PAX_CHD_C\" type=\"xs:short\" default=\"0\" minOccurs=\"0\" />\r\n
    <xs:element name=\"PAX_CHD_Y\" type=\"xs:short\" default=\"0\" minOccurs=\"0\" />\r\n
    <xs:element name=\"PAX_INF\" type=\"xs:short\" default=\"0\" minOccurs=\"0\" />\r\n
    </xs:sequence>\r\n
    </xs:complexType>\r\n
    </xs:element>\r\n
    <xs:element name=\"FLTRem\">\r\n
    <xs:complexType>\r\n
    <xs:sequence>\r\n
    <xs:element name=\"CARRIER\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"FLIGHT\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"DEP\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"DES\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    <xs:element name=\"DATE_UTC\" type=\"xs:string\" minOccurs=\"0\" />\r\n
    </xs:sequence>\r\n
    </xs:complexType>\r\n
    </xs:element>\r\n
    </xs:choice>\r\n
    </xs:complexType>\r\n
    </xs:element>\r\n
    </xs:schema>\r\n
    <diffgr:diffgram xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:diffgr=\"urn:schemas-microsoft-com:xml-diffgram-v1\">\r\n
    <NewDataSet>\r\n
    <FLT diffgr:id=\"FLT1\" msdata:rowOrder=\"0\">\r\n
    <CARRIER>XY</CARRIER>\r\n
    <FLIGHT>1234</FLIGHT>\r\n
    <DEP>ABC</DEP>\r\n
    <DES>DEF</DES>\r\n
    <DATE_LOC>11.03.2014 00:00:00</DATE_LOC>\r\n
    <ETD_LOC>30.12.1899 08:30:00</ETD_LOC>\r\n
    <ETA_LOC>30.12.1899 12:15:00</ETA_LOC>\r\n
    <DATE_UTC>11.03.2014 00:00:00</DATE_UTC>\r\n
    <ETD_UTC>30.12.1899 07:30:00</ETD_UTC>\r\n
    <ETA_UTC>30.12.1899 12:15:00</ETA_UTC>\r\n
    <PAX_C>0</PAX_C>\r\n
    <PAX_Y>120</PAX_Y>\r\n
    <SEAT_C>0</SEAT_C>\r\n
    <SEAT_Y>210</SEAT_Y>\r\n
    <PAX_EX>0</PAX_EX>\r\n
    <PAX_CHD_C>0</PAX_CHD_C>\r\n
    <PAX_CHD_Y>0</PAX_CHD_Y>\r\n
    <PAX_INF>0</PAX_INF>\r\n
    </FLT>\r\n
    <FLT diffgr:id=\"FLT2\" msdata:rowOrder=\"1\">\r\n
    <CARRIER>YZ</CARRIER>\r\n
    <FLIGHT>4567</FLIGHT>\r\n
    <DEP>DEF</DEP>\r\n
    <DES>GHI</DES>\r\n
    <DATE_LOC>11.03.2014 00:00:00</DATE_LOC>\r\n
    <ETD_LOC>30.12.1899 13:10:00</ETD_LOC>\r\n
    <ETA_LOC>30.12.1899 18:35:00</ETA_LOC>\r\n
    <DATE_UTC>11.03.2014 00:00:00</DATE_UTC>\r\n
    <ETD_UTC>30.12.1899 13:10:00</ETD_UTC>\r\n
    <ETA_UTC>30.12.1899 17:35:00</ETA_UTC>\r\n
    <PAX_C>0</PAX_C>\r\n
    <PAX_Y>203</PAX_Y>\r\n
    <SEAT_C>0</SEAT_C>\r\n
    <SEAT_Y>210</SEAT_Y>\r\n
    <PAX_EX>0</PAX_EX>\r\n
    <PAX_CHD_C>0</PAX_CHD_C>\r\n
    <PAX_CHD_Y>0</PAX_CHD_Y>\r\n
    <PAX_INF>0</PAX_INF>\r\n
    </FLT>\r\n
    </NewDataSet>\r\n
    </diffgr:diffgram>\r\n
    </DataSet>

  • [Forum FAQ] How to calculate the total count of insert rows within a Foreach Loop Container in SSIS?

    Introduction
    We need to loop through all the flat files that have the same structure in a folder and import all the data to a single SQL Server table. How can we obtain the total count of the rows inserted to the destination SQL Server table?
    Solution
    We can use Execute SQL Task or Script Task to aggregate the row count increment for each iteration of the Foreach Loop Container. The following steps are the preparations before we add the Execute SQL Task or Script Task:
    Create a String type variable FilePath, two Int32 type variables InsertRowCnt and TotalRowCnt.
    Drag a Foreach Loop Container to the Control Flow design surface, set the Enumerator to “Foreach File Enumerator”, specify the source folder and the files extension, and set the “Retrieve file name” option to “Fully qualified”.
    On the “Variable Mappings” tab of the container, map the variable FilePath to the collection value.
    Drag a Data Flow Task to the container, in the Data Flow Task, add a Flat File Source, a Row Count Transformation, and an OLE DB Destination, and join them. Create a Flat File Connection Manager to connect to one of the flat files, and then configure the
    Flat File Source as well as the OLE DB Destination adapter. Set the variable for the Row Count Transformation to “User::InsertRowCnt”.
    Open the Property Expressions Editor for the Flat File Connection Manager, and set the expression of “ConnectionString” property to
    “@[User::FilePath]”.
    (I) Execute SQL Task Method:
    In the Control Flow, drag an Execute SQL Task under the Data Flow Task and join them.
    Create one or using any one existing OLE DB Connection Manager for the Execute SQL Task, set the “ResultSet” option to “Single row”, and then set the “SQLStatement” property to:
    DECLARE @InsertRowCnt INT,
                   @TotalRowCnt INT
    SET @InsertRowCnt=?
    SET @TotalRowCnt=?
    SET @TotalRowCnt=@InsertRowCnt+@TotalRowCnt
    SELECT TotalRowCnt=@TotalRowCnt
    On to parameter 1. 
    On the “Result Set” tab of the Execute SQL Task, map result 0 to variable “User::TotalRowCnt”.
    (II) Script Task Method:
    In the Control Flow, drag a Script Task under the Data Flow Task and join them.
    In the Script Task, select variable InsertRowCnt for “ReadOnlyVariables” option, and select variable TotalRowCnt for “ReadWriteVariables”.
    Edit the Main method as follows (C#):
    public void Main()
    // TODO: Add your code here
    int InsertRowCnt = Convert.ToInt32(Dts.Variables["User::InsertRowCnt"].Value.ToString()
    int TotalRowCnt = Convert.ToInt32(Dts.Variables["User::TotalRowCnt"].Value.ToString());
    TotalRowCnt = TotalRowCnt + InsertRowCnt;
    Dts.Variables["User::InsertRowCnt"].Value = TotalRowCnt;
    Dts.TaskResult = (int)ScriptResults.Success;
              Or (VB)
              Public Sub Main()
            ' Add your code here
            Dim InsertRowCnt As Integer =        
            Convert.ToInt32(Dts.Variables("User::InsertRowCnt").Value.ToString())
            Dim TotalRowCnt As Integer =
            Convert.ToInt32(Dts.Variables("User::TotalRowCnt").Value.ToString())
            TotalRowCnt = TotalRowCnt + InsertRowCnt
            Dts.Variables("User::TotalRowCnt").Value = TotalRowCnt
            Dts.TaskResult = ScriptResults.Success
           End Sub
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Microsoft SQL Server 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hi ITBobbyP,
    If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
    If in this scenario, please refer to the following tips:
    The Foreach Loop container should be configured as shown below:
    Enumerator: Foreach ADO.NET Schema Rowset Enumerator
    Connection String: The OLE DB Connection String for the excel file.
    Schema: Tables.
    In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
    The connection string for Excel Connection Manager is the original one, we needn’t make any change.
    Change Table Name or View name to the variable Sheet_Name.
    If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
    http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Can I append the file name from a Foreach Loop Container Enumerator into a SQL Server Statement?

    I would like to pass back via an Email the name of the file that was successfully FTP'ed to a remote server. And I was hoping to do this via an Execute SQL Task with the following SQL Statement...but I just don't know if it will append the Foreach Loop Container
    variable enumerator to the appended Email message that I am building in SQL Server or if I can and how I can...
    I sort of get the feeling that I can try and do this via Dynamic SQL...I just don't know if by building dynamic SQL if my Foreach Loop Container enumerator variable will be appended to my Email Message via the SQL Server UPDATE 
    @[User::FTPFHFileName]
    Or do I add a Data Flow Task and an OLE DB Command and pass the Foreach Loop Container enumerator variable to a Stored Procedure referenced in the OLE DB Command via a "?"
    Thanks for your review and am hopeful for a reply.

    Hello,
    It seems that the issue had been solved and thanks for your sharing. It will be very beneficial for other community members who have similar questions.
    I’d like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings or concerns you may have.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to get Parent nodes and corresponding child nodes in BI Hierarchy

    Hi all,
    I have a standard function module 'RSNDI_SHIE_STRUCTURE_GET3'  to get child node if i pass parent node. But I need child nodes along with the provided parent node as I use this in a loop in BI.
    Thanks

    Could any one help me in this regards .
    Thanks in advance
    Regards,
    sri

  • Child node insert performance

    (Oracle Database 11g 11.1.0.6.0)
    I just ran a test to continually insert child XML nodes into an XML table and found performance slow. As the documentation states, the reason appears to be because the entire XML is being read into memory each time as a DOM before the insert.
    My question is whether there is a higher performing means of performing child node inserts?
    The test is as follows:
    i)     Create a non-schema based XML type table:
                        CREATE TABLE myTable1 (
                             id NUMBER,
                             XML_COLUMN XMLType
                        XMLTYPE COLUMN xml_document store as binary xml
    ii)     The table is initialized with one row of data:
         0, XMLTYPE('<trace-envelope>
                   <metadata>
                        <pid>12345</pid>
                        <date>2008-05-30</date>
                   </metadata>
              </trace-envelope>')
    iii)     Insert/append successive XML data using the following statement:
         UPDATE MyTable1 SET XML_COLUMN = APPENDCHILDXML(XML_COLUMN," +
              "'trace-envelope', XMLType('" + traceData + "'))";
         where 'traceData' is some new XML data for insertion. The view on the row then becomes (for example):
         0, XMLTYPE('<trace-envelope>
                   <metadata>
                        <pid>12345</pid>
                        <date>2008-05-30</date>
                   </metadata>
                   <EP>
                        <priceDate>
                             2008-05-30
                        </priceDate>
                   </EP>
              </trace-envelope>')
    iv)     Continue appending successive child nodes.

    The only thing I currently can think of is maybe a negative impact of updating / re-balancing the index tree during appending in the XMLType OR structure.
    SQL> select * from user_segments where segment_type like '%INDEX%'
      2  order by segment_type
      3  /
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                             131072        16         2          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    15 rows selected.
    SQL> select * from user_segments
      2  /
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    ACTION_TABLE                                                  NESTED TABLE       ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060305C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    LINEITEM_TABLE                                                NESTED TABLE       ASSM       USERS                             131072        16         2          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_OR                                              TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00005$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00011$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00016$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00025$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CLOB                                            TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060324C00003$$                                     LOBSEGMENT         ASSM       USERS                           14680064      1792        29          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                             131072        16         2          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CSX                                             TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060328C00003$$                                     LOBSEGMENT         SECUREFILE USERS                             327680        40         4         106496                       1   2.147E+09 2.147E+09 DEFAULT            0                                        DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    28 rows selected.
    SQL> select dbms_lob.getlength(t.xmldata)
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_CLOB t;
    XMLDocSize
         73114
    1 row selected.
    SQL>
    SQL> select dbms_lob.getlength(t.object_value.getclobval())
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_CSX t;
    XMLDocSize
         68682
    1 row selected.
    SQL>
    SQL> select dbms_lob.getlength(t.object_value.getclobval())
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_OR t;
    XMLDocSize
         85342
    1 row selected.
    SQL>
    SQL> truncate table PURCHASEORDER_CLOB;
    Table truncated.
    SQL> truncate table PURCHASEORDER_CSX;
    Table truncated.
    SQL> truncate table PURCHASEORDER_OR;
    Table truncated.
    SQL> var DOCUMENT VARCHAR2(4000)
    SQL> --
    SQL> set define off
    SQL> --
    SQL> begin
      2    :DOCUMENT :=
      3  '<PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PurchaseOrder.xsd">
      4     <Reference>AMCEWEN-20030409123336271PDT</Reference>
      5     <Actions>
      6             <Action>
      7                     <User>KPARTNER</User>
      8             </Action>
      9     </Actions>
    10     <Reject/>
    11     <Requestor>Allan D. McEwen</Requestor>
    12     <User>AMCEWEN</User>
    13     <CostCenter>S30</CostCenter>
    14     <ShippingInstructions>
    15             <name>Allan D. McEwen</name>
    16             <address>Oracle Plaza
    17  Twin Dolphin Drive
    18  Redwood Shores
    19  CA
    20  94065
    21  USA</address>
    22             <telephone>650 506 7700</telephone>
    23     </ShippingInstructions>
    24     <SpecialInstructions>Expidite</SpecialInstructions>
    25     <LineItems>
    26             <LineItem ItemNumber="1">
    27                     <Description>Traffic</Description>
    28                     <Part Id="696306038924" UnitPrice="39.95" Quantity="2"/>
    29             </LineItem>
    30             <LineItem ItemNumber="2">
    31                     <Description>General Idi Amin Dada</Description>
    32                     <Part Id="37429166529" UnitPrice="29.95" Quantity="3"/>
    33             </LineItem>
    34             <LineItem ItemNumber="3">
    35                     <Description>This is Spinal Tap</Description>
    36                     <Part Id="715515009126" UnitPrice="39.95" Quantity="3"/>
    37             </LineItem>
    38             <LineItem ItemNumber="4">
    39                     <Description>Great Expectations</Description>
    40                     <Part Id="37429128022" UnitPrice="39.95" Quantity="1"/>
    41             </LineItem>
    42             <LineItem ItemNumber="5">
    43                     <Description>The Unbearable Lightness Of Being</Description>
    44                     <Part Id="37429140222" UnitPrice="29.95" Quantity="2"/>
    45             </LineItem>
    46             <LineItem ItemNumber="6">
    47                     <Description>Blood of a Poet</Description>
    48                     <Part Id="37429147429" UnitPrice="0.0" Quantity="1"/>
    49             </LineItem>
    50             <LineItem ItemNumber="7">
    51                     <Description>Juliet of the Spirits</Description>
    52                     <Part Id="37429165829" UnitPrice="29.95" Quantity="4"/>
    53             </LineItem>
    54             <LineItem ItemNumber="8">
    55                     <Description>Insomnia</Description>
    56                     <Part Id="37429138229" UnitPrice="29.95" Quantity="4"/>
    57             </LineItem>
    58             <LineItem ItemNumber="9">
    59                     <Description>Picnic at Hanging Rock</Description>
    60                     <Part Id="37429126325" UnitPrice="29.95" Quantity="3"/>
    61             </LineItem>
    62             <LineItem ItemNumber="10">
    63                     <Description>W.C. Fields - Six Short Films</Description>
    64                     <Part Id="715515010726" UnitPrice="29.95" Quantity="4"/>
    65             </LineItem>
    66     </LineItems>
    67  </PurchaseOrder>';
    68  end;
    69  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> set timing on
    SQL>  --
    SQL> insert into PURCHASEORDER_OR values ( XMLType(:DOCUMENT))
      2  /
    1 row created.
    Elapsed: 00:00:00.06
    SQL>
    SQL> insert into PURCHASEORDER_CLOB values ( XMLType(:DOCUMENT))
      2   /
    1 row created.
    Elapsed: 00:00:00.01
    SQL>
    SQL> insert into PURCHASEORDER_CSX values ( XMLType(:DOCUMENT))
      2  /
    1 row created.
    Elapsed: 00:00:00.03
    SQL> commit;
    Commit complete.
    Elapsed: 00:00:00.01
    SQL> create or replace synonym PURCHASEORDER for PURCHASEORDER_OR
      2  /
    Synonym created.
    Elapsed: 00:00:00.03
    SQL> call appendLineItems(1001,2000)
      2  /
    Call completed.
    Elapsed: 00:00:04.78
    SQL> call appendLineItems(2001,3000)
      2  /
    Call completed.
    Elapsed: 00:00:09.39
    SQL> call appendLineItems(3001,4000)
      2  /
    Call completed.
    Elapsed: 00:00:13.93
    SQL> call appendLineItems(4001,5000)
      2  /
    Call completed.
    Elapsed: 00:00:18.70
    SQL> call appendLineItems(5001,6000)
      2  /
    Call completed.
    Elapsed: 00:00:23.65
    SQL> call appendLineItems(6001,7000)
      2  /
    Call completed.
    Elapsed: 00:00:28.18
    SQL> call appendLineItems(7001,8000)
      2  /
    Call completed.
    Elapsed: 00:00:32.98
    SQL> call appendLineItems(8001,9000)
      2  /
    Call completed.
    Elapsed: 00:00:37.78
    SQL> call appendLineItems(9001,10000)
      2  /
    Call completed.
    Elapsed: 00:00:43.03
    SQL> select * from user_segments where segment_type like '%INDEX%'
      2  order by segment_type;
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                             393216        48         6          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                             196608        24         3          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    15 rows selected.
    Elapsed: 00:00:00.17
    SQL> select * from user_segments;
    SEGMENT_NAME                   PARTITION_NAME                 SEGMENT_TYPE       SEGMENT_SU TABLESPACE_NAME                    BYTES    BLOCKS   EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS  MAX_SIZE RETENTI MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_
    ACTION_TABLE                                                  NESTED TABLE       ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060305C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060305C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004114                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    LINEITEM_TABLE                                                NESTED TABLE       ASSM       USERS                             917504       112        14          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004115                                                   INDEX              ASSM       USERS                             393216        48         6          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_OR                                              TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00004$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00004$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00005$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00005$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00011$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00011$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00016$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00016$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060304C00025$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060304C00025$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004116                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004117                                                   INDEX              ASSM       USERS                             196608        24         3          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004118                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CLOB                                            TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060324C00003$$                                     LOBSEGMENT         ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_IL0000060324C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004119                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    PURCHASEORDER_CSX                                             TABLE              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_LOB0000060328C00003$$                                     LOBSEGMENT         SECUREFILE USERS                             131072        16         1         106496                       1   2.147E+09 2.147E+09 DEFAULT            0                                        DEFAULT
    SYS_IL0000060328C00003$$                                      LOBINDEX           ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    SYS_C004120                                                   INDEX              ASSM       USERS                              65536         8         1          65536                       1   2.147E+09 2.147E+09                                                             DEFAULT
    28 rows selected.
    Elapsed: 00:00:00.17
    SQL> select index_name, table_name, blevel, LEAF_BLOCKS, DISTINCT_KEYS, AVG_LEAF_BLOCKS_PER_KEY, AVG_DATA_BLOCKS_PER_KEY
      2  from user_indexes
      3  ;
    INDEX_NAME                     TABLE_NAME                        BLEVEL LEAF_BLOCKS DISTINCT_KEYS AVG_LEAF_BLOCKS_PER_KEY AVG_DATA_BLOCKS_PER_KEY
    SYS_C004114                    ACTION_TABLE                           0           1             1                       1                       1
    SYS_IL0000060305C00004$$       ACTION_TABLE
    SYS_C004115                    LINEITEM_TABLE                         1           2           511                       1                       1
    SYS_C004119                    PURCHASEORDER_CLOB                     0           1             1                       1                       1
    SYS_IL0000060324C00003$$       PURCHASEORDER_CLOB
    SYS_C004120                    PURCHASEORDER_CSX                      0           1             1                       1                       1
    SYS_IL0000060328C00003$$       PURCHASEORDER_CSX
    SYS_C004116                    PURCHASEORDER_OR                       0           1             1                       1                       1
    SYS_IL0000060304C00025$$       PURCHASEORDER_OR
    SYS_IL0000060304C00016$$       PURCHASEORDER_OR
    SYS_IL0000060304C00011$$       PURCHASEORDER_OR
    SYS_IL0000060304C00005$$       PURCHASEORDER_OR
    SYS_IL0000060304C00004$$       PURCHASEORDER_OR
    SYS_C004117                    PURCHASEORDER_OR                       0           1             1                       1                       1
    SYS_C004118                    PURCHASEORDER_OR                       0           1             1                       1                       1
    15 rows selected.
    Elapsed: 00:00:00.15
    SQL> select dbms_lob.getlength(t.object_value.getclobval())
      2         as "XMLDocSize"
      3  from   PURCHASEORDER_OR t;
    XMLDocSize
       1505177
    1 row selected.
    Elapsed: 00:00:00.42
    SQL> set autotrace ON EXPLAIN
    SQL> select count(*) from PURCHASEORDER, XMLTABLE (
      2  '/PurchaseOrder/LineItems/LineItem' passing OBJECT_VALUE)
      3  /
    COUNT(*)
         9010
    1 row selected.
    Elapsed: 00:00:00.07
    Execution Plan
    Plan hash value: 3089669143
    | Id  | Operation           | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |                  |     1 |    53 |     9  (12)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |                  |     1 |    53 |            |          |
    |*  2 |   HASH JOIN         |                  |   511 | 27083 |     9  (12)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| PURCHASEORDER_OR |     1 |    34 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| LINEITEM_TABLE   |   511 |  9709 |     5   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003200033$")
       4 - filter("SYS_NC_TYPEID$" IS NOT NULL)

  • Foreach loop

    Hello,
    I am trying to convert a normal for loop to the new foreach loop. I was able to do one function that prints every element, but can't seem to be able to modify the elements in the array.
    //This works ok
    public static void printjoy(int [][] array1)
    System.out.println();
    for (int x[] : array1)
    for (int y : x)
    System.out.print(y);
    System.out.println();
    System.out.println();
    //This causes no errors, but it doesn't do the "element plus 10". It just returns the same array unchanged.
    public static void adjArray(int [][] array2)
    for (int x[] : array2)
    for (int y : x)
    y = y +10;
    This is the array declaration and initialization:
    int [][] joy = {
    {66,4,73,4},
    {81,82,81,18},
    {20,22,69,76},
    {71,65,84,79}
    This is how I call the two functions:
    printjoy(joy); //original array
    adjArray(joy); //add ten to each element
    printjoy(joy); //print adjusted array
    Thanks in advance for any help.
    Message was edited by:
    mgkicker

    I am trying to convert a normal for loop to the new
    foreach loop. I was able to do one function that
    prints every element, but can't seem to be able to
    modify the elements in the array.Right, you can't do that.
    for (int ii : arr) {
      ii = 0; // just changes ii, not the array element it's a copy of
    is equivalent to
    for (int ix = 0; ix < arr.length; ix++) {
      int ii = arr[ix];
      ii = 0; // just changes ii, not the array element it's a copy of
    }With the foreach loop, you don't have access to the array, only to the element's value.

  • ForEach Loop - Parsing XML subgroup into Variables

    Hi all,I am designing a new ETL process using SSAS.
    We have a controller package which receives an XML string at run time into a variable called BatchRequest :-
    <Batch>
    <Request>
    <Name>Filemon</Name>
    <Params>
    <filepaths>
    <Sourcepath>d:\temp</Sourcepath>
    <Destpath>D:\temp2</Destpath>
    <Archivename>\Archive</Archivename>
    </filepaths>
    </Params>
    </Request>
    </Batch>
    The Batch can contain a number of Requests and a ForEach Loop is used to parse the text for the Name node and the text for the Params Node into variables RequestName and RequestParams respectively.
    however, what I want to be able to do is to take the text for <name> into Requestname but take the entire XML sub string for <Params> into RequestParams.
    At the moment I get the text only (e.g. d:\tempd:\temp2\Archive).
    The Requestname is used by an XML task within the ForEach loop to retrieve full package path details from an external config file, and hence it only needs to be a keyword.
    I played with the idea of including <Params> as a subnode for <Name>, only populating RequestName in the loop parser and then having an XML task which would parse the related parameter string, but i don't know how to tell the XML task that I
    want the parameter string where the <Name> is Filemon (in this example).
    Can anyone give me some suggestions or pointers?
    Thanks
    Iain
    Iain

    Hi idcowden,
    Glad to hear that you have resolved the issue on your own. Thank you for sharing the solution.
    Regards,
    Mike Yin
    TechNet Community Support

  • Sum on child nodes based on attribute value in xslt

    Hi all,
    Any one can post helpful code to calculate the sum of child nodes based on the attribute value of other child node.
    Let's say for example.
    I have one child element has attribute value let's say Tax so I have to put condition on child element having value of "Tax" I need to calcualte sum of Invoice amount that element is also child node
    After calculating sum I have to apply that sum at the header level of the Invoice. For each Invoice I have calculate sum and apply at the header level.

    It isn't working :(.Got the following error:
    An error was reported compiling the XPath expression: error: XPath expression invalid, not a selection: declare namespace ws = 'http://www.bea.com/wli/sb/transports/ws';
    declare namespace tuxedo = 'http://www.bea.com/wli/sb/transports/tuxedo';
    declare namespace wsa = 'http://schemas.xmlsoap.org/ws/2004/08/addressing';
    declare namespace http = 'http://www.bea.com/wli/sb/transports/http';
    declare namespace xsi = 'http://www.w3.org/2001/XMLSchema-instance';
    declare namespace wsp = 'http://schemas.xmlsoap.org/ws/2004/09/policy';
    declare namespace file = 'http://www.bea.com/wli/sb/transports/file';
    declare namespace xsd = 'http://www.w3.org/2001/XMLSchema';
    declare namespace soap12-env = 'http://www.w3.org/2003/05/soap-envelope';
    declare namespace flow = 'http://www.bea.com/alsb/flow/transport';
    declare namespace sftp = 'http://www.bea.com/wli/sb/transports/sftp';
    declare namespace sb = 'http://www.bea.com/wli/sb/transports/sb';
    declare namespace soap-enc = 'http://schemas.xmlsoap.org/soap/encoding/';
    declare namespace ejb = 'http://www.bea.com/wli/sb/transports/ejb';
    declare namespace soap-env = 'http://schemas.xmlsoap.org/soap/envelope/';
    declare namespace jpd = 'http://www.bea.com/wli/sb/transports/jpd';
    declare namespace email = 'http://www.bea.com/wli/sb/transports/email';
    declare namespace tp = 'http://www.bea.com/wli/sb/transports';
    declare namespace dsp = 'http://www.bea.com/dsp/transport/sb';
    declare namespace ctx = 'http://www.bea.com/wli/sb/context';
    declare namespace soap12-enc = 'http://www.w3.org/2003/05/soap-encoding';
    declare namespace wsu = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd';
    declare namespace jms = 'http://www.bea.com/wli/sb/transports/jms';
    declare namespace ftp = 'http://www.bea.com/wli/sb/transports/ftp';
    fn:string(./xml-fragment/@IntObjectName).

Maybe you are looking for