Xml newbie - multiple loops for children in xml?

Hi all,
I am hoping someone can help me with this!
I have what I guess is a pretty basic xml that I need to parse and insert in a table. I have the basic code where I loop through the node list and assign values in the table type, and then insert into the table.
However, I have multiple levels of data that I plan to insert in one de-normailized table. So, for example:
<POHDR>
.. some fields...
<POLINE>... several fields of info ...
<PODISTLINE> ... more pieces of info ...
</PODISTLINE>
</POLINE>
<POLINE>... several fields of info ...
<PODISTLINE> ... more pieces of info ...
</PODISTLINE>
<PODISTLINE> ... more pieces of info ...
</PODISTLINE>
</POLINE>
.. multiple such lines
<POHDR>
<POHDR>
<POLINE>... several fields of info ...
<PODISTLINE> ... more pieces of info ...
</PODISTLINE>
</POLINE>
<POLINE>... several fields of info ...
<PODISTLINE> ... more pieces of info ...
</PODISTLINE>
<PODISTLINE> ... more pieces of info ...
</PODISTLINE>
</POLINE>
.. multiple such lines
<POHDR>
All this would go in one staging table with multiple lines of po_header, po_lines and distribution lines information.
I have the pretty basic generic code, where I do the loop and assign values:
v_parser := xmlparser.newParser;
xmlparser.parseclob (v_parser, p_po_clob_file);
v_doc := xmlparser.getDocument (v_parser);
xmlparser.freeparser (v_parser);
v_po_nl := xslprocessor.selectNodes(xml.makeNode(v_doc), 'POFILE');
FOR i in 0.. sys.xmldom.getLength(v_po_nl)-1 LOOP
v_po_n := sys.xmldom.item(v_po_nl, i)
v_po_rec.extend;
v_po_rec(v_po_rec.last).ponum := sys.xslprocessor.valueOf(v_po_n, 'PONUM');
...... etc.
... and then the insert.
But I don't know what to do about getting the PO line and PO Distribution line child items. I guess I could do :
v_po_rec(v_po_rec.last).polinnum := sys.xslprocessor.valueOf(v_po_n, 'POLINNUM');
but wouldn't I need to do another loop to find the child line items - and then another to get line distributions?
Please help!
Thanks a lot!

Thanks - and yes, understood.
However, my XMLType data is not in a XMLType table (just a column of a regular table), so I cannot use the extract functions.
I am not using XML Schemas - right now that is not in the works. We may look into that later.
I did try using xmlsave - but again, that just saves the data in top rowset (PO Header, and does not insert any line items in the table)
Isn't there a way to do this with just a loop? I tried looking at your child example Re: How to use PL/SQL to read and manipulate data from a xml file , but that does not loop to go through multiple children..
Is there a way to do this with a loop using xmldom? Or a way to do it using xmlsave (but also saving the child rowsets?
Again, any help will be most appreciated - if you can tell me there isn't then I will look into one of the other options.
Thanks again!

Similar Messages

  • Stupid question from a Mac newbie: multiple users for webbased email

    This problem has infuriated me over the last 4 hours---likely a keychain/cookie issue--- but help has been hard to find. New computer Latest OS X.
    I use safari (or firefox) to log into a web based email account (happens to be an exchange server). initial screen comes up. Click on 'log in'. Up pops a username/password screen. Type in user name, password, don't click on "save password", get into my email account--- no problem. Check email, happy.
    My wife, wants to log into her account.
    I quit safari or firefox. She clicks on the icon. initial screen comes up. Click on 'log in' and up comes MY EMAIL. She did not log on.
    Not sure what to do. Want to set up the web-based email to not automatically log someone into another persons' email as I want to use this computer basically as one account, with multiple people logging into muliple web based email.
    Can this be done easily?

    Hi,
    I quit safari or firefox. ...
    Just to be devils advocate, mind if I ask how you quit the applications? If you just closed the window by clicking the red circle at the top left corner, then both Safari and Firefox would still be running with your login session details still active.
    Try pressing command+q to really quit the application (or click and hold the Dock icon and select Quit). Alternatively, select 'Logout' (or the equivalent option) on your web email account to close your active session.

  • How to print multiple footers for each page in RTF template xml report.

    Hi,
    How to print multiple footers for each page in RTF template xml report.
    i am able to print ( two sets ) ...
    up to last page ( one template ) and for last page ( another template).
    i want to change the footer information based on the group value printed in the report ( it might be 5 to 6) In every report run.. can you please check and let me know do we have any feasibility to achieve this.
    Thanks in advance.
    Regards,
    KAP.

    You can remove all other logic, like last page only contents (start@last-page:body), etc and section breaks if any you have inserted manually.
    Just have for-each@section logic.
    It would be difficult for me to guess what you have done without looking at your RTF or describing here.

  • For Each Loop for XML Task

    Hello Everyone,
    Please assist with a step by step guide on how to setup a For Each Loop for XML Task
    I'm trying to convert XML to XSLT
    I have tried more than 10 times and i just do not know what i am doing wrong - no error, my package just runs for a few seconds but nothing happens
    Thanks in advance
    Dee

    I managed to get my XML to XSLT to work but now when i run my package to import the data into SQL table,
    it stops after a few records, i get the following error: 
    [XML Source [1]] Error: The component "XML Source" (1) was unable to process the XML data. The element "Errors" cannot contain a child element. Content model is text only.
    Please assist
    Check this:
    http://social.msdn.microsoft.com/Forums/en-US/80726e0c-9e85-43ca-87bc-7cf90fd7fb31/xml-source-data-flow-throws-cannot-contain-a-child-element-content-model-is-text-only-error?forum=sqlintegrationservices
    Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
    The climb is all there is.

  • Multiple loops in one loop for text variables

    Dear experts,
    Please find the code below.This is text variable customer exit.Can u ple help me to put these multiple loops into one loop.Do u suggest this code is ok?
    Appreciate your help.
    WHEN 'ZSTXTPE01AA'or 'ZSTXT0FISCPER305AA'or 'ZSTXT0FISCYEAR01AA'
    INCLUDE Z_VARIABLES_TEXT
    DATA: vtype i,
          fisper i,
          fisyear i
    IF I_STEP=2.
    LOOP AT I_T_VAR_RANGE INTO loc_var_range WHERE VNAM='ZS0VTYPE01AA'
    vtype=LOC_VAR_RANGE-LOW
    ENDLOOP.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW= vtype.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'EQ'.
    LOOP AT I_T_VAR_RANGE INTO loc_var_range WHERE VNAM='ZS0FISCPER305AA'
    fisper=LOC_VAR_RANGE-LOW
    ENDLOOP.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW= fisper.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'EQ'.
    LOOP AT I_T_VAR_RANGE INTO loc_var_range WHERE VNAM='ZS0FISCYEAR01AB'
    fisyear=LOC_VAR_RANGE-LOW
    ENDLOOP.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW= fisyear.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'EQ'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDIF.
    Rgds
    ACE

    Hi ACE BW,
    You can try to use the SELECT statement and then include the LOOP inside it.
    Thanks,
    Daniel

  • Not able to generate multiple lines for headers in report

    Hi,
    I am new to BI publisher and not able to generate multiple lines for headers. Please help me to resolve.
    I am using RTF template, data source as PS Query and XML file (system generated from the data source)
    When I am using system generated 'First XML' file, I am getting output in the follwoing format.
    TEAM_MEMBER, PROJECT_ID, NAME, START_DT
    e.g.
    EMP1 , 71000, Sample, 01-Jan-2010
    EMP1 , 72000, Sample, 01-Feb-2010
    EMP1 , 73000, Sample, 01-March-2010
    But I want the report to be generate with multiple projects for one employee like below format , for that I used 'Second XML' file but I am getting blank report.
    In short if there is one to many case, how to show in reports??? Please correct if I am going wrong.
    TEAM_MEMBER
    PROJECT_ID, NAME, START_DT
    PROJECT_ID, NAME, START_DT
    PROJECT_ID, NAME, START_DT
    e.g.
    EMP1
    71000, Sample, 01-Jan-2010
    72000, Sample, 01-Feb-2010
    73000, Sample, 01-March-2010
    **********First XML**************System generated XML ****************************
    <?xml version="1.0"?>
    <query numrows="2" queryname="SY_EMP_PROJECT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="">
    <row rownumber="1">
    <TEAM_MEMBER>TEAM_MEMBER </TEAM_MEMBER>
    <PROJECT_ID>PROJECT_ID samp</PROJECT_ID>
    <NAME>NAME sample data</NAME>
    <START_DT>2010-08-25</START_DT>
    </row>
    <row rownumber="2">
    <TEAM_MEMBER>TEAM_MEMBER</TEAM_MEMBER>
    <PROJECT_ID>PROJECT_ID samp</PROJECT_ID>
    <NAME>NAME sample data</NAME>
    <START_DT>2010-08-25</START_DT>
    </row>
    </query>
    **********Second XML**************Manually created XML and using to show multiple projects for one employee****************
    <?xml version="1.0"?>
    <TEST numrows="2" queryname="SY_EMP_PROJECT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="">
    <TEAM_MEMBER rownumber="1">
    <TEAM_MEMBER>1</TEAM_MEMBER>
    <EMPLOYEE_NAME>SAMPLE</EMPLOYEE_NAME>
    <PROJECT>
    <PROJECT_ID>1111</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01012010</START_DATE>
    </PROJECT>
    <PROJECT>
    <PROJECT_ID>1112</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01022010</START_DATE>
    </PROJECT>
    </TEAM_MEMBER>
    <TEAM_MEMBER rownumber="2">
    <TEAM_MEMBER>2</TEAM_MEMBER>
    <EMPLOYEE_NAME>SAMPLEC</EMPLOYEE_NAME>
    <PROJECT>
    <PROJECT_ID>1111</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01012010</START_DATE>
    </PROJECT>
    <PROJECT>
    <PROJECT_ID>1112</PROJECT_ID>
         <PROJECT_DESCR>SAMPLE</PROJECT_DESCR>
    <START_DATE>01022010</START_DATE>
    </PROJECT>
    </TEAM_MEMBER>
    </TEST>
    Edited by: ganeshtw on Aug 25, 2010 12:14 AM

    Hi,
    With your first xml you can print like
    EMP1
    71000, Sample, 01-Jan-2010
    72000, Sample, 01-Feb-2010
    73000, Sample, 01-March-2010While creating the RTF template you can use the Group by option.
    <?for-each-group:ROW;./columnname> then print the column name
    <?columnname?>
    --Then your table format
    71000, Sample, 01-Jan-2010
    72000, Sample, 01-Feb-2010
    73000, Sample, 01-March-2010
    <?end for-each-group?>
    Thanks.

  • Multiple initializers for property dataProvider

    All I'm trying to do is display xml data from a Rails application in a list., but it doesn't like this:
                        dataProvider="{student_requests.student_request}"
    It tells me "multiple initializers for property dataProvider".
    Any idea of how to address this? Thanks.
      <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;   
                [Bindable]
                private var student_requests:XML;
                private const CONTEXT_URL:String = "http://localhost:3000";
                private function initApp():void {
                    student_requestsIndex.send();
                protected function textInput_enterHandler():void
                    currentState='List';
                protected function list_changeHandler():void
                    currentState='Detail';
                protected function button_clickHandler():void
                    currentState='List';
                protected function button_clickHandler_1():void
                    currentState='Search';
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="Detail"/>
            <s:State name="List"/>
            <s:State name="Search"/>
        </s:states>
        <fx:Declarations>
            <s:HTTPService
                id="student_requestsIndex"
                url="{CONTEXT_URL}/student_requests.xml"
                resultFormat="e4x"
                result="student_requests=event.result as XML"/>       
            <s:HTTPService
                id="student_requestsCreate" url="{CONTEXT_URL}/student_requests.xml"
                method = "POST"
                resultFormat="e4x"
                contentType="application/xml"
                result="student_requestsIndex.send()"/>
            <s:HTTPService
                id="student_requestsUpdate" url="{CONTEXT_URL}/student_requests/{student_requestsGrid.selectedItem.id}/confirm_reques t"
                method="POST"
                resultFormat = "e4x"
                contentType="application/xml"
                headers="{{X_HTTP_METHOD_OVERRIDE: 'PUT'}}" />
        </fx:Declarations>
            <fx:DesignLayer d:id="49" ai:objID="644a1270" d:userLabel="LeftPanel" visible.Search="false" id="designlayer2">
            <s:List skinClass="components.DataList3" x="65" y="96"
                        change="list_changeHandler()"
                        id="list1"
                        dataProvider="{student_requests.student_request}"
                        labelField="student_request">
                    <s:ArrayCollection>
                        <fx:String></fx:String>
                        <fx:String></fx:String>
                        <fx:String></fx:String>
                        <fx:String></fx:String>
                        <fx:String></fx:String>
                    </s:ArrayCollection>
                </s:List>
            </fx:DesignLayer>

    Yeah I removed it but still no data.
    I was referencing this:
    http://www.adobe.com/devnet/flashcatalyst/articles/building_datacentric_app_flas hcast_flashbuilder_03.html
    But he uses Coldfusion, and I tried using the HTTP to connect to data, but the data would never display properly. So I was forced to use HTTPService declarations, which prompted me to change code around. And this was one of it. His approach generated this:
                <s:List skinClass="components.DataList3" x="65" y="96" change="list_changeHandler()" id="list1" creationComplete="list1_creationCompleteHandler(event)" dataProvider="{TypeUtility.convertToCollection(indexResult.lastResult)}" labelField="student_request">
                </s:List>

  • Cluster Apex MS's across multiple nodes for load balancing?

    Can Cluster Apex MS's across multiple nodes for load balancing? If Yes/No, any supportive doc's will be much appreciated.
    Here is what I did ..........
    I tried multiple MS's on different nodes for Apex Domain (clustered)
    Deployed apex.war, i.war with targets pointing to cluster.
    Apex listener techstack is shared filesystem $HOME/apex, where apex-config.xml and bdb are available
    Anyone of the MS's whichever started up first is locking up bdb and 500 server shows up when internal workspace is being launched with host specific url, where as it works fine for the host which actually locked up bdb (first MS that was started)
    2nd MS shows errors as below in log files ..
    Caused By: com.sleepycat.je.EnvironmentLockedException: (JE 4.0.103)$HOME/apex/bdb The environment cannot be locked for single writer access. ENV_LOCKED: The je.lck file could not be locked. Environment is invalid and must be closed.
    Its expected behavior until here .....
    ++++ I tried something to get it working ++++
    Whilst both MS's are up and running, delete $HOME/apex/bdb but let apex-config,xml be as it is...now the internal workspace urls for both hosts work fine. I logged into host specific urls and navigated, created/edited users.,etc and it is all looking good but it did not create new bdb directory under $HOME/apex ...!!
    Having said its working fine, the same issue repeats after the MS's bounce. So I did put a command line to delete bdb dir once the MS comes up to avoid the issue but really not sure if this is the right way at all?
    Geek's ...awaiting your advice!!

    Hey there,
    I managed to fulfill my requirement..
    If its a cluster on same machine or across machines, this should work
    1. Login to machine, cd $DOMAIN_HOME
    2. mkdir -p Apex_lsn_config/AdminServer Apex_lsn_config/<MS1> Apex_lsn_config/<MS2> # MS1 and MS2 are the Managed Server names as appropriate
    #If you are planning for cluster spawning MS's across machines, make sure you create the dir's on step 2 for each machine respectively. (in my case $DOMAIN_HOME is not shared)
    3. Copy apex-config.xml from the /tmp/apex or whatever location you have it currently to Apex_lsn_config/<MS1> Apex_lsn_config/<MS2>
    4. cd $DOMAIN_HOME/bin; cp -p SetDomainEnv.sh SetDomainEnv.sh.orig #Backup the file
    5. Append -Djava.io.tmpdir in SetDomainEnv.sh as below for JAVA_OPTIONS # Do it on both machine if you are not sharing DOMAIN_HOME and planning cluster across machines
    -Djava.io.tmpdir=$DOMAIN_HOME/APEX_CONFIG/${SERVER_NAME}
    Hint: Search for "iterativeDev" and append the same line with -Djava.jo.tmpdir
    6. Modify "java.io.tmpdir" from the web.xml file of apex.war as below and re-deploy the war
    <context-param>
         <param-name>config.dir</param-name>
         <param-value>${java.io.tmpdir}</param-value>
    </context-param>
    7. Bounce Weblogic Admin and Manged Servers. Make sure to tail the Managed Server log to see apex-config.xml is picked from the new location.
    8. Brew a Coffee for yourself :)
    - You find the instructions on creating a cluster from weblogic documentation, the steps mentioned above are only to overcome the bdb locking issue whilst creating a cluster.
    Did it help?
    Edited by: Oratime on Mar 25, 2013 2:44 AM

  • Got multiple values for non null local custom field

    Hi,
    I get the following error message while saving a MPP from Project Professional to MS Project Server:
    Got multiple values for non null local custom field.
    I checked the MPP and found that there are fields with same alias as Enterprise field names. However, these fields are at a Task level, whereas the Enterprise fields are at a Project Level.
    I would like to know why this is happening and the resolution for this issue. I don't want to delete the local fields.
    Any help in this regard will be appreciated.

    Then try to find any inconsistencies in the project plans with the issues, like required values not entered. Also try to save the plan as XML format and save it back as an mpp file to see if it helps (be aware that any formatting will be lost).
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • How to write "for loop" for this block in as3?

    hello all, could you please help me to write a for loop for the following code?
    PS: bx1,bx,2bx3... are movie clips, xfir1,xsay1,xad1,xtip1,xdil1 are dynamic text boxes.
    var xmlLoader9:URLLoader = new URLLoader();
    xmlLoader9.addEventListener(Event.COMPLETE, showXML99);
    xmlLoader9.load(new URLRequest("spops.xml"));
    function showXML99(e:Event):void
    XML.ignoreWhitespace = true;
    var fir:XML = new XML(e.target.data);
    bx1.xfir1.text =  fir.sno[0].aa.text();
    bx1.xsay1.text =  fir.sno[0].bb.text();
    bx1.xad1.text  =  fir.sno[0].cc.text();
    bx1.xtip1.text =  fir.sno[0].dd.text();
    bx1.xdil1.text =  fir.sno[0].ee.text();
    bx2.xfir2.text =  fir.sno[1].aa.text();
    bx2.xsay2.text =  fir.sno[1].bb.text();
    bx2.xad2.text  =  fir.sno[1].cc.text();
    bx2.xtip2.text =  fir.sno[1].dd.text();
    bx2.xdil2.text =  fir.sno[1].ee.text();
    bx3.xfir3.text =  fir.sno[2].aa.text();
    bx3.xsay3.text =  fir.sno[2].b.text();
    bx3.xad3.text  =  fir.sno[2].cc.text();
    bx3.xtip3.text =  fir.sno[2].dd.text();
    bx3.xdil3.text =  fir.sno[2].ee.text();

    And for the second, try this:
    var stThings:Array = [st1, st2, st3];
    var bxThings:Array = [bx1, bx2, bx3]
    var globalURLRequest:URLRequest = new URLRequest ("tgs.aspx?st=1003")
    for each(var stWhat in stThings)
    stWhat.addEventListener(MouseEvent.CLICK, clickHandler);
    stWhat.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
    stWhat.addEventListener(MouseEvent.MOUSE_OUT , outHandler);
    function clickHandler(event:MouseEvent):void
    navigateToURL(globalURLRequest,"_blank")
    function overHandler(event:MouseEvent):void
    var index:int = stThings.indexOf(event.target);
    bxThings[index].visible = true;
    function outHandler(event:MouseEvent):void
    var index:int = stThings.indexOf(event.target);
    bxThings[index].visible = false;
    It's difficult to interpret your code--you may want to take some time to write more readable code.
    For example, what is an 'st1'? Is it a button? What does it do?
    Consider if it were a button made to load Story 1... a much more readable name would be btnStory1.
    Also, there really is no advantage to identifying events as eeeeevt, zeeeevt and changing those.
    Pick a convention and stick to it. I prefer 'event', others use 'e' or 'evt'.
    And try to use function names that mean something, "function a1003mo(zeeevt2:MouseEvent):void {" is much more easily read as "function outHandler(event:MouseEvent):void"
    I'd be interested to see what it is you're making, I believe there are some real opportunities to optimize it.
    HTH
    -Ted

  • Multiple Loops folders causing delayed loading?

    I have installed Logic Studio and GB and updated all the software, restarted the computer and I find that some of the new loops or instruments in GB take 2 to several minutes to load up. Loops and instruments like Timpani. I have several Loop folders:
    Libraries > Application Support > GarageBand > Apple Loops or Apple Loops Index. There is NOTHING in the Apple Loops or Apple Loops Index folders.
    Libraries > Application Support > Audio > Apple > multiple folder with info in it including > Apple Loops for GarageBand and > Jam Packs
    In the Libraries > Application Support > Logic (folder) there are no Loops
    Should I move the Loops to the have GB access them more quickly? Alias folder and how do I create that?
    THANKS!
    A teacher who wants to upgrade her Lab for 200 students!

    To do this, in iTunes go to Edit>Preferences>Advanced Tab>General Tab and then uncheck the "Keep iTunes Music Folder Organized" box.
    That has nothing to do with iTunes looking for music on your computer.
    Keep iTunes music folder organized will create a folder hierarchy of artist and album names that contains all relevant audio files with the correct track names and order.
    When you run iTunes for the first time (only), it asks to search your computer for music.
    After the first time, the ONLY music that will get added to iTunes is the music you add. iTunes does not add music based on what you put in folders. It does not "watch" to see if anything is added to a folder.
    If you do not want music copied to the iTunes music folder when adding to library, (and you want the music in your own folders somewhere else), set it in the prefs.

  • How to use a loop for a object

    Hi, All
    I have a procedure that needs a collection to pass in. The pass_in collection has multiple records with multiple fields, so I guess I need a loop for each record.
    How to assign each record of multiple fields to each corresponding local variables?
    Thanks In advance
    T_Object is a table object
    T_ProfileInfo is a collection
    procedure P_Updateprofile(UserId in number, NewProfileInfo in T_ProfileInfo) as
    V_B_ID number;
    V_A_ID number;
    V_Profile      T_ProfileInfo;     
    begin
         V_Profile := NewProfileInfo;
         --use the loop for each records
    FORALL i IN V_Profile.FIRST..V_Profile.LAST
    -- assign each value to the local variables
    -- I got error here. ideally I want to assign each record to the local variables
         select B_ID, A_ID
         into V_B_ID, V_A_ID
         from table(V_Profile(i));
         -- insert the record into the table
         INSERT INTO PROFILE
         VALUES (UserId, V_B_ID, V_A_ID);
         commit;
    end;

    You don't say which version of the database you are using. Oracle extended the collections functionality in 9.2....
    Cheers, APC
    SQL> CREATE OR REPLACE PACKAGE t1_utl AS
      2      TYPE rt_t1 IS TABLE OF t1%ROWTYPE;
      3      FUNCTION gen_t1 (p1 IN NUMBER) RETURN rt_t1;
      4      PROCEDURE pop_t1 (t1rows IN rt_t1);
      5  END t1_utl;
      6  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY t1_utl AS
      2      FUNCTION gen_t1 (p1 IN NUMBER) RETURN rt_t1
      3      IS 
      4          CURSOR cur (pn NUMBER) IS
      5              SELECT a12.NEXTVAL, col1, col2, rownum AS rn, substr(col3,30), sysdate
      6              FROM t2
      7              WHERE rownum <= pn;
      8          return_value rt_t1;
      9      BEGIN
    10          OPEN cur(p1);
    11          LOOP
    12              FETCH cur BULK COLLECT INTO return_value LIMIT 100;
    13              EXIT WHEN cur%NOTFOUND;
    14          END LOOP;
    15          RETURN return_value;
    16      END gen_t1;
    17      PROCEDURE pop_t1 (t1rows IN rt_t1) IS
    18      BEGIN
    19          FORALL indx IN t1rows.FIRST .. t1rows.LAST
    20              INSERT INTO t1
    21                VALUES t1rows (indx);
    22      END pop_t1;
    23  END t1_utl;
    24  /
    Package body created.
    SQL> SELECT * FROM t1
      2  /
    no rows selected
    SQL> DECLARE
      2      x t1_utl.rt_t1;
      3  BEGIN
      4      x := t1_utl.gen_t1(2);
      5      t1_utl.pop_t1(x);
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t1
      2  /
          COL1       COL2       COL3       COL4 COLA
    COLD
            56     165765      87979          1
    11-AUG-04
            57       3128    8217220          2
    11-AUG-04
    SQL>

  • Multiple plans for my SQL- Which one is following?-11gr2

    11gr2, windows-64-bit
    I have one sql_id part of 3rd part application, need to tune it. When I tried to get its execution plan im seeing multiple plan_plan values. That means, multiple plans for
    same sql_id
    How could we know that which plan my sql_id is following.?
    SQL> set lines 300
    SQL> set pages 50
    SQL> select * from TABLE(dbms_xplan.display_awr('5z1r29wc6514q'));
    PLAN_TABLE_OUTPUT
    SQL_ID 5z1r29wc6514q
    SELECT INVOICE_ID,min(CHARGE_DATE),MAX(CHARGE_DATE),
    sum(TOTAL_EXCL_VAT),sum(case when instr(LEVEL2,:"SYS_B_0")>:"SYS_B_1"
    then SUM_QUANTITY else :"SYS_B_2" end) as KB from
    RATOR_CDR.INVOICE_DETAIL_LINE I  INNER JOIN SUBSCRIPTION S ON S.ID =
    I.SUBSCRIPTION_ID  inner join SERVICE S1 on S1.SUBSCRIPTION_ID=S.ID
    WHERE INVOICE_ID in (SELECT id from  RATOR.INVOICE WHERE
    invoice_number is  null) and  S1.PHONE_NUMBER=:1   and LEVEL1=:2  group
    by  INVOICE_ID
    Plan hash value: 216300602
    | Id  | Operation                            | Name                  | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                     |                       |       |       |  1350 (100)|       |          |       |
    |   1 |  HASH GROUP BY                       |                       |   333 | 40293 |  1350   (1)| 00:00:17 |       |       |
    |   2 |   HASH JOIN                          |                       |   333 | 40293 |  1348   (1)| 00:00:17 |       |       |
    |   3 |    NESTED LOOPS                      |                       |       |       |            |       |          |       |
    |   4 |     NESTED LOOPS                     |                       |  1638 |   161K|   866   (0)| 00:00:11 |       |       |
    |   5 |      NESTED LOOPS                    |                       |     1 |    34 |     2   (0)| 00:00:01 |       |       |
    |   6 |       TABLE ACCESS BY INDEX ROWID    | SERVICE               |     1 |    23 |     2   (0)| 00:00:01 |       |       |
    |   7 |        INDEX RANGE SCAN              | SERVICE__PHONE_NUMBER |     1 |       |     1   (0)| 00:00:01 |       |       |
    |   8 |       INDEX UNIQUE SCAN              | SUBSCRIPTION__ID_PK   |     1 |    11 |     0   (0)|       |          |       |
    |   9 |      PARTITION RANGE ALL             |                       |  1684 |       |    46   (0)| 00:00:01 |     1 |    17 |
    |  10 |       INDEX RANGE SCAN               | IDL_SUB_ID            |  1684 |       |    46   (0)| 00:00:01 |     1 |    17 |
    |  11 |     TABLE ACCESS BY LOCAL INDEX ROWID| INVOICE_DETAIL_LINE   |  1581 |   103K|   864   (0)| 00:00:11 |     1 |     1 |
    |  12 |    TABLE ACCESS FULL                 | INVOICE               |  6048 |   118K|   481   (1)| 00:00:06 |       |       |
    SQL_ID 5z1r29wc6514q
    SELECT INVOICE_ID,min(CHARGE_DATE),MAX(CHARGE_DATE),
    sum(TOTAL_EXCL_VAT),sum(case when instr(LEVEL2,:"SYS_B_0")>:"SYS_B_1"
    then SUM_QUANTITY else :"SYS_B_2" end) as KB from
    RATOR_CDR.INVOICE_DETAIL_LINE I  INNER JOIN SUBSCRIPTION S ON S.ID =
    I.SUBSCRIPTION_ID  inner join SERVICE S1 on S1.SUBSCRIPTION_ID=S.ID
    WHERE INVOICE_ID in (SELECT id from  RATOR.INVOICE WHERE
    invoice_number is  null) and  S1.PHONE_NUMBER=:1   and LEVEL1=:2  group
    by  INVOICE_ID
    Plan hash value: 1282779260
    | Id  | Operation                            | Name                  | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT                     |                       |       |       |  1392 (100)|       |          |       |
    |   1 |  HASH GROUP BY                       |                       |   325 | 39000 |  1392   (1)| 00:00:17 |       |       |
    |   2 |   HASH JOIN                          |                       |   325 | 39000 |  1391   (1)| 00:00:17 |       |       |
    |   3 |    TABLE ACCESS FULL                 | INVOICE               |  5972 |   116K|   550   (1)| 00:00:07 |       |       |
    |   4 |    NESTED LOOPS                      |                       |       |       |            |       |          |       |
    |   5 |     NESTED LOOPS                     |                       |  1794 |   175K|   840   (0)| 00:00:11 |       |       |
    |   6 |      NESTED LOOPS                    |                       |     1 |    34 |     2   (0)| 00:00:01 |       |       |
    |   7 |       TABLE ACCESS BY INDEX ROWID    | SERVICE               |     1 |    23 |     2   (0)| 00:00:01 |       |       |
    |   8 |        INDEX RANGE SCAN              | SERVICE__PHONE_NUMBER |     1 |       |     1   (0)| 00:00:01 |       |       |
    |   9 |       INDEX UNIQUE SCAN              | SUBSCRIPTION__ID_PK   |     1 |    11 |     0   (0)|       |          |       |
    |  10 |      PARTITION RANGE ALL             |                       |  1836 |       |    48   (0)| 00:00:01 |     1 |    18 |
    |  11 |       INDEX RANGE SCAN               | IDL_SUB_ID            |  1836 |       |    48   (0)| 00:00:01 |     1 |    18 |
    |  12 |     TABLE ACCESS BY LOCAL INDEX ROWID| INVOICE_DETAIL_LINE   |  1722 |   110K|   838   (0)| 00:00:11 |     1 |     1 |
    ------------------------------------------------------------------------------------------------------------------------------also, Any suggestions to tune this query
    Thanks

    Harry wrote:
    11gr2, windows-64-bit
    I have one sql_id part of 3rd part application, need to tune it. how do plan on modifying 3 ^rd^ party application?

  • Producer loop and 2 consumer loop for acquisition and process images

    Hello everybody,
    I'm quite a newbie in Labview 2011 on Windows 7.
    Those are what I want to do :
    Step 1: When the objects fall with velocity around 2 to 5 m/s, images of these objects will be acquired continuously from PCIe 1433 with Basler spL4096-39kc.
    Step 2: The processing of the images continuously in the same time with step 1 will find the datas of the objects in images as colors, patterns and locations. If the patterns and colors at location are as the same sample, the elements in Boolean data array are true.
     Step 3: Every 01 millisecond, values from Boolean data array will be read, the valves of nozzle will be opened if the values are true.
     My question is what is the best way to do my tasks ? I couldn't find any example of program in Labview and I think I use producer/consumer architecture for step 1 and 2 but I don't know how can I set up producer loop for step 3 and transfer Boolean data array from step 2 to step 3 ?
    Thank you for reading and help me !

    Dear Eric-J,
    Thanks for your reply. I want sort the pellets that have 6mm diameter. The pellets were fed in a single layer by a vibratory feeder with a flat-bottom trough, 400mm wide that was supplied with the feeder . The pellets dropped off the end of the feeder onto a chute with 40 parallel U-shaped grooves. Images of these pellets will be acquired continuously. I make the sample from image that was acquired. I use NI Vision for processing  of the images. If the patterns and colors of pellets are as the same sample, the elements in boolean data array are true. As you thought, I would like to interpret data every millisecond and open/close a valve based on the boolean array. The air valve sends a burst of air for 2 - 3 milliseconds to an air nozzle that diverts the pellets into the appropriate channel.
    What are your ideas for this task ? Could you explain more clearly about "a real time system" and "determinism" for this task ?
    Thanks and best regards

  • How to uploade multiple flatfiles for single transaction using BDC?

    How to uploade multiple flatfiles for single transaction using BDC?

    Hi,
    You need to upload all data files into an internal table first either using OPEN DATASET (application server files) or GUI_UPLOAD (PC files).
    Then loop at the internal table and call BDC transaction to process the data.
    Regards,
    Ferry Lianto

Maybe you are looking for

  • How do I fix a botched attempt to delete Xcode?

    Okay, So I had xcode. Then I no longer wanted it. So I planned to delete it. I did so by finding the developer folder within my HD, dragging the whole thing to the trash and then emptying it. I later found out that I should have actually run a termin

  • Drag and Drop files on mac?

    I've been using Dreamweaver for years but this is the first time on a mac. I noticed that I can't simply drag documents into my files view in Dreamweaver. Am I doing something wrong? Is the only way around this to keep one window open with all the si

  • MPD and Last.FM

    this might be a longshot but i was wondering if there was a way for mpd to interface with last.fm. i know i can get a scrobbler working with no problem but i would really love to be able to listen to last.fm streams and get the whole love/ban/skip fu

  • Table name for WBS element deleted

    If a  WBS element is deleted , the corresponding object id which is internally created by the system is also deleted from the PRPS table, Is there a way to find all the deleted WBS elements and what is the table name for the same.

  • I'm a computer nerd and need help

    I just loaded adobe photoshop elelments 10.  I would like to get photos from my pictures and load them in to photoshop, but can't seem to do it.  Can anyone help me?