How do i loop through a pl/sql collection based on a condition.

hi, can any one help me or provide me sample code where  i have to loop through a collection  based on condition . just like where clause in sql. your help is highly appreciated....
{code}
create table MODEL1
  model_id  NUMBER ,
  model_seq NUMBER,
  p_ind     VARCHAR2(1)
insert into model1 (MODEL_ID, MODEL_SEQ, P_IND)
values (4, 103, 'U');
insert into model1 (MODEL_ID, MODEL_SEQ, P_IND)
values (3, 102, 'P');
insert into model1 (MODEL_ID, MODEL_SEQ, P_IND)
values (2, 101, 'U');
insert into model1 (MODEL_ID, MODEL_SEQ, P_IND)
values (1, 100, 'P');
MODEL PROCEDURE......
procedure (  param1,param2)        ( assume this procedure is being called from other procedure and collection has been populated already)
TYPE  l_tab is table of  MODEL1%rowtype;
begin
loop through l_tab records where  ltab.model_id=param1  and  p_ind =p
Join based on if else condition.
if   param2 is not null then
   l_tab.model_seq=param2 and ltab.p_ind='P'
if param2 is null then
         l_tab.p_ind='P'          etc...........
   {code}

Hi,
Try something like this:
DECLARE
TYPE L_TAB IS  TABLE OF MODEL1%rowtype;
TAB L_TAB;
param1 number := 1;
param2 number := 999;
BEGIN
select
  model_id
  ,model_seq
  ,p_ind
bulk collect into TAB
from
  MODEL1
DBMS_OUTPUT.PUT_LINE('PARAM1: ' || PARAM1);
DBMS_OUTPUT.PUT_LINE('PARAM2: ' || PARAM2);
DBMS_OUTPUT.PUT_LINE('     MODEL_ID, MODEL_SEQ, P_IND' );
FOR X IN TAB.FIRST .. TAB.LAST
LOOP
DBMS_OUTPUT.PUT_LINE('OLD: ' || TAB(X).MODEL_ID || '         ' || TAB(X).MODEL_SEQ || '        ' || TAB(X).P_IND );
    IF TAB(X).model_id = param1 AND TAB(X).p_ind = 'P' THEN
      IF param2       IS NOT NULL THEN
        TAB(X).model_seq := param2;
--        TAB(X).p_ind := 'P';     -- THIS IS NOT NEEDED SINCE THE CONDITION STATE L_TAB(X).P_IND = 'P' ALREADY
NULL;
      END IF;
      IF param2     IS NULL THEN
--          TAB(X).p_ind  := 'P'; -- THIS IS NOT NEEDED SINCE THE CONDITION STATE L_TAB(X).P_IND = 'P' ALREADY
NULL;
      END IF;
    END IF;
DBMS_OUTPUT.PUT_LINE('NEW: ' || TAB(X).MODEL_ID || '         ' || TAB(X).MODEL_SEQ || '        ' || TAB(X).P_IND );
END LOOP;
END;
PARAM1: 1
PARAM2: 999
     MODEL_ID, MODEL_SEQ, P_IND
OLD: 4         103        U
NEW: 4         103        U
OLD: 3         102        P
NEW: 3         102        P
OLD: 2         101        U
NEW: 2         101        U
OLD: 1         100        P
NEW: 1         999        P
Regards,
Peter

Similar Messages

  • How do I: Loop through Application objects

    How would I loop through the application object?  My goal is to see if the object is a label and change its font size.
    pseudocode would look like this:
    function setsize(change int) {
      for each obj in application {
        if obj is of type label {
          set font size to font size + change
    Once I got that working, I'd add other objects that display text.  The "change" would be a number to increase (positive) or decrease (negative) the size.
    Thanks,
    Jerry

    I have this:
              <mx:HBox id="resultTextBox"
                  width="100%"
                  verticalScrollPolicy="off" horizontalScrollPolicy="auto">
                  <mx:Label id="resultPotentialResultsLabel"
                      text="Food Stamp potential eligibility for household, estimated monthly benefit amount "
                      styleName="textNormal"
                      toolTip="Results message"
                      tabIndex="200" tabEnabled="true"  fontSize="40"/>
                  <mx:Text id="resultPotentialResultsData"
                      styleName="resultNumberNormal"
                      toolTip="Final results"
                      tabIndex="202" tabEnabled="true" />
              </mx:HBox>
    When I expand the font size it pushes the "resultPotentialResutsData" to limbo.  I tried adding the horizonal scroll bar to allow the user to still see the results,  The scroll doesn't appear.
    1) is there a way to get the box to expand to fix the content?
    2) is there a way to get the scroll bar to appear when needed?
    3) is there a way to wrap the text (in this case the second field) in the HBox?

  • Multi-record block (how do I loop through the block)

    I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
    reports that they want to run. When they click on <NEXT> button, I create a multi-record
    control block and display each record on the second screen using
    go_block;
    clear_block;
    move data;
    create_record;
    The user then selects on the second canvas which reports to run now and which to run later via
    a LOV. When they press the <RUN> button, I want to start at the first record and either run the
    report or schedule it. Then I want to move onto the second and the third until all selected reports
    have been handled. I know I should use a loop but can't seem to make it work.
    So my question is, How do I loop through the records in a multi-record control block, pass the information
    for that one record to a parameter form and then execute the request? Each control block record contains
    10 parameter fields.
    Thanks.
    Bob

    go_record(1);
    << do your processing >> -- This is executed only for the first record.
    if :system.last_record = 'TRUE' then -- If the 1st record is also the last record.
    RETURN;
    end if;
    LOOP
    next_record;
    << do your processing >>
    if :system.last_record = 'TRUE' then
    EXIT;
    end if;
    END LOOP;
    I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
    reports that they want to run. When they click on <NEXT> button, I create a multi-record
    control block and display each record on the second screen using
    go_block;
    clear_block;
    move data;
    create_record;
    The user then selects on the second canvas which reports to run now and which to run later via
    a LOV. When they press the <RUN> button, I want to start at the first record and either run the
    report or schedule it. Then I want to move onto the second and the third until all selected reports
    have been handled. I know I should use a loop but can't seem to make it work.
    So my question is, How do I loop through the records in a multi-record control block, pass the information
    for that one record to a parameter form and then execute the request? Each control block record contains
    10 parameter fields.
    Thanks.
    Bob

  • How do I loop through tables, not columns in a table?

    Sorry if this is a long one. My problem is actually quite simple. I am trying to write either an ad hoc PL/SQL block or a stored procedure to loop 18 times (thru 18 tables) and perform a SQL query on those tables, returning 18 resultsets. I would like the results to show up on the screen (or in a spool file, whatever).
    So far I have tried 3 different approaches, none of which have worked.
    1. I tried to assign the select query to a variable (qry) and use EXECUTE IMMEDIATE qry. This forced me thru a variety of errors to declare variables and assign the result to them--EXECUTE IMMEDIATE qry into nm0, nm1, nm2...
    The problem with that was the resultset returned more than the variable was built for as there might be no rows returned, or it might be a thousand rows of data. So I tried changing the variables to VARRAYS, but it gave me a type mismatch as the underlying columns were NUMBER and VARCHAR2.
    DECLARE
         ctr number;
         TYPE NUMLIST IS VARRAY (1000) OF NUMBER;
         TYPE VARLIST IS VARRAY (1000) OF VARCHAR2(15);
         nm0 NUMLIST NOT NULL DEFAULT 1;
         nm1 VARLIST;
         nm2 NUMLIST NOT NULL DEFAULT 1;
         nm3 VARLIST;
         nm17 NUMLIST NOT NULL DEFAULT 1;
         qry VARCHAR2(2000) := 'klx_uln_p000_cells';
    BEGIN
    FOR ctr IN 1..17 LOOP
         IF ctr &lt; 10 THEN
              qry := 'SELECT
              A.DIM_0_INDEX,
              S0.SYM_NAME,
              A.DIM_1_INDEX,
              S1.SYM_NAME,
              A.DIM_2_INDEX,
              S2.SYM_NAME,
              A.DIM_3_INDEX,
              S3.SYM_NAME,
              A.NUMERIC_VALUE,
              B.NUMERIC_VALUE
              FROM
              KHALIX.klx_uln_p00'||ctr||'_cells A,
              KHALIX.klx_ucn_p00'||ctr||'_cells B,
              KHALIX.KLX_MASTER_SYMBOL S0,
              KHALIX.KLX_MASTER_SYMBOL S1,
              KHALIX.KLX_MASTER_SYMBOL S7
              WHERE
              A.DIM_0_INDEX=B.DIM_0_INDEX AND
              A.DIM_1_INDEX=B.DIM_1_INDEX AND...
              A.DIM_7_INDEX=S7.SYM_INDEX';
         ELSE
              qry := 'SELECT
              A.DIM_0_INDEX...
              A.DIM_7_INDEX=S7.SYM_INDEX';
         END IF;
         BEGIN
         dbms_output.put_line('SELECT FOR KLX_ULN_P00'||ctr||'_CELLS');
         dbms_output.put_line(nm16);
         dbms_output.put_line(nm17);
         EXECUTE IMMEDIATE qry into nm0,nm1,nm2,nm3,nm4,nm5,nm6,nm7,nm8,nm9,nm10,nm11,nm12,nm13,nm14,nm15,nm16,nm17;
    --     dbms_output.put_line(qry);
         dbms_output.put_line(nm16);
         dbms_output.put_line(nm17);
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   dbms_output.put_line('No data found for Query '||ctr);
         END;
    END LOOP;
    EXCEPTION
         WHEN NO_DATA_FOUND THEN
              dbms_output.put_line('No data found for Query '||ctr);
    END;
    2. So then I used REF CURSOR to create a stored procedure and return the values. That allowed me to run my query AND tokenize the tablenames with a counter so that it would loop through the different tables! However, I still could not get it to display the results without going to SQL Plus and typing 'print c;'.
    3. So, finally I tried to create a looping wrapper around the ref cursor to have some variable (ctr) increment so my query would get performed on table0_cells through table17_cells. This, too, did not work.
    If I manually go to SQL Plus and type:
    variable ctr number
    begin
    :ctr := 1;
    end;
    exec dupe_find(1,:c);
    it will execute for the first table (klx_uln_p001_cells) and I can then type 'print c' to see what was returned. But when I try putting this within a wrapper PL/SQL block with a Loop to make ctr go from 0 - 17 (to loop through table_names klx_uln_p000_cells to klx_uln_p017_cells), it does not work.
    Help! It should be very simple to loop through tables, shouldn't it? I just want a script that will loop through tables, perform a query on each table and display the results. For some reason, I can only find documentation examples on looping through columns that are all in the same table.
    Dave

    Here's a working example using your first strategy ...
    create table t1 (id number);
    create table t2 (id number);
    insert into t1 values (100);
    insert into t1 values (101);
    insert into t2 values (200);
    insert into t2 values (201);
    declare
    v_table_name user_tables.table_name%type;
    type ttab_id is table of t1.id%type index by binary_integer;
    tab_id ttab_id;
    begin
    for i in 1 .. 2 loop
    v_table_name := 't' || i;
    execute immediate 'select id from ' || v_table_name
    bulk collect into tab_id;
    dbms_output.put_line('query from ' || v_table_name);
    for j in 1 .. tab_id.count loop
    dbms_output.put_line(tab_id(j));
    end loop;
    end loop;
    end;
    There are many other ways to do this (especially if you need to do more than just print out the data).
    Richard

  • How do I Loop through a recordset using PHP

    I have a recordset containing a MySql table with 5 columns, each one containing an email address of an official in a club.
    Each row represents a different club, and each column a different type of official.
    The first column represents chairmen, the next treasurers etc...
    The recordset is called $mailset.
    I need to loop through each row of $mailset and extract the email addresses of each column and concatenate them into a string seperated by semi colons ; so it ends up like this:
    [email protected];[email protected];[email protected]; and so on.
    This is how the recordset is set up:
    mysql_select_db($database_dummyread, $dummyread);
    $query_mailset = "SELECT club_chair_email, club_treas_email, club_sec_email, club_delegate_email, club_deputy_email FROM clubs";
    $mailset = mysql_query($query_mailset, $dummyread) or die(mysql_error());
    $row_mailset = mysql_fetch_assoc($mailset);
    $totalRows_mailset = mysql_num_rows($mailset);
    ?>
    I tried using a  loop to step through the recordset, but it always shows the first record, so its not moving the pointer through the file.
    The pseudo code aught to be something like this:
    Initialise variables and move to the first record
    If there are records to process
                   Read a record
                        Process all columns
                Move on to the next record
    else
         if there are no records
              print an error message
    else
    Print the results.
    Can anyone give me a hint as to how to move from row to row in a recordeset under the control of a loop.
    I am using PHP and MySql. (as far as I know, it is the original - not PDO or MySqli)

    Each call to mysql_fetch_assoc($mailset) retrieves the value at the current location and increments the pointer in the recordset array. So use either a do or while loop and call mysql_fetch_assoc($mailset) from within the loop.
    From the docs:
    Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array.

  • Loop Through Rows in SQL Report.

    Hello Everyone,
    I've been creating a very different application, and I've run into quite the roadblock.
    Let me give you a breif about the problem.
    I have a form that needs to be dynamic and thus is created at runtime.
    I have used the APEX_ITEM and a SQL SELECT CASE to create a dynamic report.
    For example if the DATATYPE column in my table says DATE, I create an APEX_ITEM.DATE_POPUP, if it says CHAR i create a textbox, and if a column called
    LOV is populated APEX_ITEM.SELECT_LIST_FROM_QUERY using the number value of the LOV to query a List of Values from another table.
    Now this brings me to say in a single column of the there could be different data_types. meaning the multi-row update functionality with apex will not work.
    Getting the data to display is easy. However saving the updates is a different story.
    Which brings me to my question. Does anybody know of way in which you can loop through each row in a SQL Report on APEX and assess each row individually.
    I'd like to accomplish something like this
    LOOP
    MyUpdateProcedure(currentrow_id,currentrow_datatype, currentrow_value)
    Go to Next Row in Report
    END LOOP;
    Pretty simple in theory? Do we have an APEX expert out there who could give me a hand with this?

    Codes,
    It sounds to me like you could add a hidden field to tell you what you need to know in order to determine the column to update.
    Assuming it was created using the parameter p_idx = 50 and contained the names you provided (eg DATA_DATA) and your primary key is created using p_idx = 1 then you could add the logic for the update into an on submit process something like so
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    CASE apex_application.g_f50(i)
    WHEN 'DATA_DATA' THEN
    -- run the update against the data column
    WHEN 'CHAR_DATA' THEN
    -- run the update against the char column
    etc.
    If the multi-type column is created with the apex_item api using p_idx = 2 then you just refer to it in the loop as apex_application.g_f02(i) and the primary key is apex_application.g_f01(i).
    I hope this helps.
    Greg

  • How do I loop through AFrames?

    I feel dumb asking this but I really think the code I have should work. All I want to do is loop through all the aframes in a document. To do this, I assign the first Aframe to a variabe named vAFrame. Then, I created a while loop where the test is vAFrame.ObjectValid(). however, the while loop never tests to true even though the data browsers shows that the vAFrame variable contains a valid object AND it supports the ObjectValid() method AND the valid object is an AFrame. I must be missing something really obvious here. Any ideas?
    main ()
    function main()
        var vDoc=app.ActiveDoc;
        var vFlow=vDoc.MainFlowInDoc;
        var vTextFrame=vFlow.FirstTextFrameInFlow;
        var vAFrame=vTextFrame.FirstAFrame;
        while (vAFrame.ObjectValid())
            vAFrame=vAFrame.NextAFrame;

    I am heads down on a project so I can't give you much code right now, but I can point you in the right direction. The method you are using only works for a single text frame, so you would also have to include a loop for all of the text frames in the flow. A better approach is to get a list of FrameAnchor items from the main flow of the document. Then you can loop through the text items to process each anchored frame.
    // Set a variable for the main flow in the document.
    var flow = doc.MainFlowInDoc;
    // Get a list of the anchored frames in the flow.
    var textItems = flow.GetText(Constants.FTI_FrameAnchor);
    // Loop through the anchored frames.
    for (var i = 0; i < textItems.len; i += 1) {
      var aFrame = textItems[i].obj;
      // Do something with the anchored frame here.
    Note that this will only get anchored frames in the main flow itself; it will skip anchored frames that are inside table cells or nested in other anchored frames. Please let me know if you have any questions or comments.
    Rick Quatro

  • How can I loop through a Vector and compare

    I'm working on a school project that is a quiz server. Instructors could telnet into the app and create quizes and then users can take them. I have it so it can set up new quizes so far. Right now I'm working on it so the user can choose a quiz and take the test. Since it requires proper user handling I have it so I display the quiz ID and quiz Name. The user would need to enter the quiz ID to take it. I have it that as it displays the ID's it enters them into a Vector. Then I do a loop through all elements until I get one that equals the user selection. I'm having problems with it though. Here's some code:
    do
    quizCheck = false;
    for (int i=0;quizReference.size();i++)
    if (selectionInt==quizReference.elementAt(i))
    quizCheck=true;
    }while (quizCheck==false);
    It's giving me a Error #300:method==(int,java,lang.Object)not found in class testproject.TestProject on the if line. Is there a way to handle this scenario. Also is there a better way?

    Hi,
    elementAt(...) returns an Object - of what type is your selectionInt? - guess, it is a primitve int value, not an Object.
    You can find it easier - say, you have Integer values in that Vector - and selectionInt is an int value - now you can find it using
    int p = quizReference.indexOf(new Integer(selectionInt));
    p is either -1 (if not found) or the index of the first found element, with the same int value as selectionInt.
    Hope, this helps
    greetings Marsian

  • JDev 10.1.3.4: How to properly loop through the rows of a VO?

    Hi,
    This is a newbie question. Using JDeveloper 10.1.3.4 I am trying to loop through the rows of a view object. I am sure that the VO returns the following rows in that order:
    200809
    200902
    200906If I use this code (where termsOpen is the VO instance):
    while (termsOpen.hasNext()) {
       System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
    }it proves to be an endless loop and I get "200809" printed on the console endlessly. The API says that hasNext() "does not move the current row". A book says that the pointer initially is at row 0. I wonder why it prints the first row. So the code is changed to:
    while (termsOpen.hasNext()) {
       Row currRow = termsOpen.next();
       System.out.println(currRow.getAttribute("Term"));
    }But now I get only the last two rows printed on the console, and do not get to see the first row:
    200902
    200906What's wrong?
    Thanks for helping!
    Newman

    Hi, Branislav,
    Thank you for the suggestion.
    I tried that also. When the code is
    while (termsOpen.hasNext()) {
       System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
       termsOpen.next();
    }I get only the first two rows and last row is dropped:
    200809
    200902To get all the three row, I end up using this code:
    System.out.println(termsOpen.first().getAttribute("Term"));
    while (termsOpen.hasNext()) {
       Row currRow = termsOpen.next();
       System.out.println(currRow.getAttribute("Term"));
    }But that shouldn't be the way of doing the work. If I use a block of 50 lines of code to process each row, the code will have to be written once before the while loop and another time inside the while loop.
    The book which says that the pointer starts at the row slot before the first row is found on the internet, on p.469. It makes sense to me that the pointer starts at row 0. But unfortunately the actual copy of JDev 10.1.3.4 I am using behaves otherwise.
    Newman

  • I was wondering how I can loop through all records in a database?

    I'm using a do while loop to loop through all the records in a database is there a way I can simulate to EOF. I tried something to simulate it but I don't think it'll work. I assume there's a better way.
    Here's my code:
    boolean noRecords=false;
    do
    noRecords=false;
    if (queryResults.next())
    serverOutput.print(queryResults.getInt("itemID");
    serverOutput.println(queryResults.getString("itemName");
    else
    noRecords=true;
    }while(noRecords==false);

    i think i know what you mean...
    try this
    while (queryResults.next()) {
    serverOutput.print(queryResults.getInt("itemID");
    serverOutput.println(queryResults.getString("itemName");
    when .next() returns false, it will exit the while loop. you don't need the other code you have there, the above should do it all.
    is that what you're after?

  • How do I loop through selected links?

    Hi!
    I'm looking for clues on how to run a script on selected links (selected in the Links window).
    Like this sample script that runs an alert when links are missing:
    var aDoc = app.activeDocument;
    for(var n = 0; n < aDoc.links.length; n++) {
         var aLink = aDoc.links[n];
         if (aLink.status == LinkStatus.linkMissing) {
              alert(aLink.filePath);
    Is there something like LinkStatus.linkSelected?
    Or some other way for the script to sort out the selected links.
    Any input would be extremely appreciated!
    Thanks!
    /Peter

    Hi,
    I would modify line #17:
    while (listSelection && cItem = listSelection.shift() ) {
    cause empty selection leads to error.
    Uwe,
    In case of unique - troubles could depends on what are you going to do with output and how.
    If we talk about dialog list only - it is much more comfortable to user just to select a link name once instead of - let say - 125 clicks (in theory).
    But maybe a better idea is to return just an array of names and convert it to useful list of object (one name into many links) outside of mDialog function()
    Jarek

  • How to dynamically Set the list of flex contexts based on a condition

    Database is in 11i atg rup7 level
    first OAF page - shows list of employees under a manager
    on clicking an employee record, the second OAF page opens and it shows a set of records from descriptive flexfield. Currently 5 contexts of the same flexfield are enabled for this responsibiltiy using the ContextA||Seg1|Seg2|Seg3||ContextB||Seg1|Seg2||ContextC||Seg1|Seg2|Seg3|Seg4||ContextD||Seg1|Seg|Seg3|Seg4||COntextE||Seg1|Seg2 in the personalisation at responsibility
    So 5 sections(one for each context) are shown in the OA page
    My requirement is to show only 3 contexts for employee 'A' and 5 contexts for the employee 'B'. Both the employees are under the same manager.So i think i cannot do a simple personalisation at responsibility level.
    So assuming ,i have some parameter like person_id , how do i dynamically restrict to 3 or 5 contexts in my controller code?

    Hi,
    Use this :
    OADescriptiveFlexBean descFlexfieldsBean = (OADescriptiveFlexBean)oawebbean.findIndexedChildRecursive("flexitemid");
    descFlexfieldsBean.processFlex(oapagecontext);
    if(descFlexfieldsBean != null)
    descFlexfieldsBean.setFlexContextCode(pageContext,"ContextName");
    Thanks,
    Gaurav

  • How to loop through XML data in a table of XMLType?

    Hi,
    I am failry new to xml document processing in Oracle using PL/SQL.
    My DB version: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    I have successfully loaded an xml document into a table using the following two statements:
    1) CREATE TABLE mytable2 OF XMLType;
    2) INSERT INTO mytable2 VALUES (XMLType(bfilename('IMAGE_FILE_LOC', 'IFTDISB20100330172157C002.xml'), nls_charset_id('AL32UTF8')));
    Now I need to traverse through the various nodes within the xml document and extract values of elements of each node. The question I have is:
    How do I loop through a node? A VALID record is enclosed within the <checkItem> </checkItem> tags.
    Here is a snippet of the data in that xml document:
    ++++++++++++++++++++++++++++++++++++++++++++++++
    <?xml version="1.0" encoding="UTF-8"?>
    <bdiData>
    <documentControlInfo>
    <documentInfo>
    <docDescription>Check images and data for Test Company, account number 1234567890</docDescription>
    <docID>
    <ID>20100330172157</ID>
    </docID>
    <docModifier>Test Company</docModifier>
    <docCreateDate>2010-03-30</docCreateDate>
    <docCreateTime>17:21:57-0700</docCreateTime>
    <standardVersion>1.0</standardVersion>
    <testIndicator>0</testIndicator>
    <resendIndicator>0</resendIndicator>
    </documentInfo>
    <sourceInfo>
    <sourceName>The Bank IFT</sourceName>
    <sourceID>
    <idOther>TheBankIFT</idOther>
    </sourceID>
    </sourceInfo>
    <destinationInfo>
    <destinationName>Test Company</destinationName>
    <destinationID>
    <idOther>FEI3592</idOther>
    </destinationID>
    </destinationInfo>
    </documentControlInfo>
    <checkItemCollection>
    <collectionInfo>
    <description>Items</description>
    <ID>1269994919135</ID>
    <Classification>
    <classification>Items</classification>
    </Classification>
    </collectionInfo>
    <checkItemBatch>
    <checkItemBatchInfo>
    <description>Paid Checks</description>
    <ID>1269994919135</ID>
    <Classification>
    <classification>Paid Checks</classification>
    </Classification>
    </checkItemBatchInfo>
    <checkItem>
    <checkItemType>check</checkItemType>
    <checkAmount>86468</checkAmount>
    <postingInfo>
    <date>2010-03-29</date>
    <RT>10700543</RT>
    <accountNumber>1234567890</accountNumber>
    <seqNum>009906631032</seqNum>
    <trancode>001051</trancode>
    <amount>86468</amount>
    <serialNumber>300040647</serialNumber>
    </postingInfo>
    <totalImageViewsDelivered>2</totalImageViewsDelivered>
    <imageView>
    <imageIndicator>Actual Item Image Present</imageIndicator>
    <imageViewInfo>
    <Format>
    <Baseline>TIF</Baseline>
    </Format>
    <Compression>
    <Baseline>CCITT</Baseline>
    </Compression>
    <ViewSide>Front</ViewSide>
    <imageViewLocator>
    <imageRefKey>201003260000738400851844567205_Front.TIF</imageRefKey>
    <imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
    </imageViewLocator>
    </imageViewInfo>
    <imageViewInfo>
    <Format>
    <Baseline>TIF</Baseline>
    </Format>
    <Compression>
    <Baseline>CCITT</Baseline>
    </Compression>
    <ViewSide>Rear</ViewSide>
    <imageViewLocator>
    <imageRefKey>201003260000738400851844567205_Rear.TIF</imageRefKey>
    <imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
    </imageViewLocator>
    </imageViewInfo>
    </imageView>
    </checkItem>
    <checkItem>
    <checkItemType>check</checkItemType>
    <checkAmount>045</checkAmount>
    <postingInfo>
    <date>2010-03-29</date>
    <RT>10700543</RT>
    <accountNumber>1234567890</accountNumber>
    <seqNum>008518967429</seqNum>
    <trancode>001051</trancode>
    <amount>045</amount>
    <serialNumber>200244935</serialNumber>
    </postingInfo>
    <totalImageViewsDelivered>2</totalImageViewsDelivered>
    <imageView>
    <imageIndicator>Actual Item Image Present</imageIndicator>
    <imageViewInfo>
    <Format>
    <Baseline>TIF</Baseline>
    </Format>
    <Compression>
    <Baseline>CCITT</Baseline>
    </Compression>
    <ViewSide>Front</ViewSide>
    <imageViewLocator>
    <imageRefKey>201003290000713900851896742901_Front.TIF</imageRefKey>
    <imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
    </imageViewLocator>
    </imageViewInfo>
    <imageViewInfo>
    <Format>
    <Baseline>TIF</Baseline>
    </Format>
    <Compression>
    <Baseline>CCITT</Baseline>
    </Compression>
    <ViewSide>Rear</ViewSide>
    <imageViewLocator>
    <imageRefKey>201003290000713900851896742901_Rear.TIF</imageRefKey>
    <imageFileLocator>IFTDISB20100330172157M002.zip</imageFileLocator>
    </imageViewLocator>
    </imageViewInfo>
    </imageView>
    </checkItem>
    <checkItemBatchSummary>
    <totalItemCount>1028</totalItemCount>
    <totalBatchAmount>61370501</totalBatchAmount>
    <totalBatchImageViewsDelivered>2056</totalBatchImageViewsDelivered>
    </checkItemBatchSummary>
    </checkItemBatch>
    <collectionSummary>
    <totalBatchCount>1</totalBatchCount>
    <totalItemCount>1028</totalItemCount>
    <totalCollectionAmount>61370501</totalCollectionAmount>
    <totalCollectionImageViewsDelivered>2056</totalCollectionImageViewsDelivered>
    </collectionSummary>
    </checkItemCollection>
    <documentSummaryInfo>
    <totalCollectionCount>1</totalCollectionCount>
    <totalBatchCount>1</totalBatchCount>
    <totalItemCount>1028</totalItemCount>
    <totalDocumentAmount>61370501</totalDocumentAmount>
    <totalDocumentImageViewsDelivered>2056</totalDocumentImageViewsDelivered>
    </documentSummaryInfo>
    </bdiData>
    ++++++++++++++++++++++++++++++++++++++++++++++++
    Any ideas and or suggestions will be greatly appreciated.
    Cheers!
    Edited by: user12021655 on Aug 3, 2010 1:25 PM

    I really need to update my blog to get the example you are looking for posted. I did a quick search on the forums for XMLTable and found a good example at {message:id=4325701}. You will want to use OBJECT_VALUE in the PASSING clause where you need to reference the column in your table.
    Note: See the FAQ in the upper right for how to use the tag to wrap objects to retain formatting.  Also your XML is missing closing nodes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Loop through nested elements and insert via PL/SQL

    INSERT INTO Orders(id, OrderXML) VALUES
    (S_Orders.Nextval,
    '<?xml version="1.0" encoding="utf-8" ?>
    <Order xmlns="urn:foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:foo foo-1.xsd">
    <OrderRef>BBB</OrderRef>
    <OrderDate>2005-03-29</OrderDate>
    <CustomerID>1051</CustomerID>
    <Items>
    <Item>
    <ProductID>7</ProductID>
    <Price>45.6</Price>
    <Quantity>2</Quantity>
    </Item>
    <Item>
    <ProductID>19</ProductID>
    <Price>73.5</Price>
    <Quantity>10</Quantity>
    </Item>
    </Items>
    </Order>'
    I some questions regarding index search of nested elements like,Items in the above example.
    I would like to know how I can LOOP through the Items like 1..2 LOOP
    and insert those elements(item) into one table. Order information should go in to another table.
    Can this be done with xpath and PL/SQL.
    Regards
    Ulf

    Hi Marco!
    Here's some more information:
    CREATE TABLE ITEM (ProductID NUMBER,
    Price NUMBER(8,2)
    Quantity 10 NUMBER);
    CREATE TABLE ORDER (OrderRef VARCHAR2(10),
    ORDER_DATE VARCHAR2(10),
    CUSTOMERID NUMBER);
    The main problem that I have is to create an solution that can be dynamic so that I can have for instance one order and four items in one XML.
    The second XML can have one order and 10 items.
    First I want to insert the order elements in the order table and then the items records in the item table.
    To complicate things futher my real XML have namespaces in the XML, but this I think I can handle.
    Summary: So for each order row(element) I want to traverse the Item elements and insert them to the Item table.
    Regards
    /Ulf

  • How to loop through a Data Node

    Hello,
    I have an Interactive Adobe form in WebDynpro Java project. 
    My data View tab includes the following structure:
    Bapi_test
    ValueHelpData
    CodeNumber
    CodeDescription
    Can someone please tell how I can loop through the “ValueHelpData” node, and get values for “CodeNumber” and “CodeDescription”
    The ValueHelpData node has the cardinality of  0..n. and has approximately 100 elements.
    Thanks. Your help is much appreciated.
    Rob.

    Hi Robby,
    You could try the following :
    int n = wdContext.nodeValueHelpData().size();
    for(int i = 0; i < n; i++)
       wdContext.nodeValueHelpData().moveTo(i);
       IPrivateMyDataView.IValueHelpDataElement ele = wdContext.currentValueHelpDataElement();
       String codenum = ele.getCodeNumber();
       String codedesc = ele.getCodeDescription();
       // Any other processing logic..//
    Hope this helps.

Maybe you are looking for