How can I run two DML in one FORALL statement?

How can I run 1) select 2) update in one FORALL for each item as below?
OPEN FXCUR;
  LOOP
        FETCH FXCUR BULK COLLECT INTO v_ims_trde_oids LIMIT 1000;
        EXIT  WHEN v_ims_trde_oids.COUNT() = 0;
     FORALL i IN v_ims_trde_oids.FIRST .. v_ims_trde_oids.LAST     
          SELECT EXTRACTVALUE(XMLTYPE(CNTNT),'/InboundGTMXML/ProcessingIndicators/ClientCLSEligibleIndicator')        INTO v_cls_ind
          FROM IMS_TOMS_MSGE  WHERE ims_trde_oid = v_ims_trde_oids(i);
         IF v_cls_ind      IS NOT NULL THEN
                  v_cls_ind       := '~2136|S|'||v_cls_ind||'|';
         UPDATE ims_alctn_hstry  SET CHNGE_DATA_1   =concat(CHNGE_DATA_1,v_cls_ind)
         WHERE ims_trde_hstry_id = (select max(ims_trde_hstry_id) from ims_alctn_hstry where ims_trde_oid=v_ims_trde_oids(i));
         DBMS_OUTPUT.PUT_LINE('Trade oid: '||v_ims_trde_oids(i)||'   CLS Eligible Indicator: '||v_cls_ind);
      END IF;
  END LOOP;
  CLOSE FXCUR;Your help will be appreciated.
Thanks
Edited by: PhoenixBai on Aug 6, 2010 6:05 PM

I came through this forum while googling on the issue of 'using two DML's in one FORALL statement.
Thanks for all the useful information guys.
I need to extend this functionality a bit.
My present scenario is as follows:
FOR I in 1..collection1.count Loop
     BEGIN
          insert into tab1(col1)
          values collection1(I) ;
     EXCEPTION
          WHEN OTHERS THEN
          RAISE_APPLICATION_ERROR('ERROR AT'||collection1(I));
     END;
     BEGIN
          UPDATE tab2
          SET col1 = collection1(I);
     EXCEPTION
          WHEN OTHERS THEN
          RAISE_APPLICATION_ERROR('ERROR AT'||collection1(I));
     END;
commit;
END LOOP;
I need to use the FORALL functionality in this scenario, but without using the SAVE EXCEPTIONS clause keeping in mind that I also need to get value in the
collection that led to the error.Also, the each INSERT statement has to be followed by an UPDATE and then the cycle goes on(Hence I cannot use 2 FORALL statements for INSERT and UPDATE coz then all the INSERT will be performed at once and similarly the UPDATEs). So I created something like this:
DECLARE
l_stmt varchar2(1000);
BEGIN
l_stmt := 'BEGIN '||
          'insert into tab1(col1) '||
          'values collection1(I) ; '||
     'EXCEPTION '||
          'WHEN OTHERS THEN '||
          'RAISE_APPLICATION_ERROR(''ERROR AT''|| :1); '||
     'END; '||
     'BEGIN '||
          'UPDATE tab2 '||
          'SET col1 = :1; '||
     'EXCEPTION '||
          'WHEN OTHERS THEN '||
          'RAISE_APPLICATION_ERROR(''ERROR AT''|| :1); '||
     'END;'
FORALL I in 1..collection1.count
EXECUTE IMMEDIATE l_stmt USING Collection1(SQL%BULK_EXCEPTIONS(1).ERROR_INDEX);
END;
Will this approach work? Or is there any better aproach to this? I am trying to avoid the traditional FOR ..LOOP to achieve better performance of query

Similar Messages

  • HT1347 How do I run two libraries from one computer?

    How do I run two libraries from one computer? One library is on the computer's hard drive, the second library is on an external hard drive. The computer that had the external hard drive crashed and I need to fix the iTunes library on it. How can I do this without corrupting the library on my internal hard drive?

    Launch iTunes with the Shift key held down and either create a new library or choose the one on the external drive. Any rented movies downloaded from another computer won't play.
    (81212)

  • How can I make two Canvas in one Window ?

    I want in the main window ( that is only window in the module ) press button to appear another canvas.
    but that I can't make it , I just made two window until the another window appear.
    that's all
    I tried with :-
    show_view('canvas_name');
    but didn't work with me Sad
    the another canvas made it stacked Canvas .... but also didn't work Sad
    so please , How can I make two Canvas in one Window only ?
    and thanks in advance

    this code work with me :-
    show_view('canvas name');
    go_block(block_name');
    execute_query;
    for HIDE button u have to write...
    hide_view('canvas_name');
    but
    that not exactly what I want ...... I want the stacked canvas appear like second window , and could control on it like window .... it could be possible ????

  • How can I run two independant LabView applications from the same computer, without taking a performance hit?

    I have two identical, but independant test stations, both feeding data back to a Data Acquisition Computer running LabView 6.1. Everything is duplicated at the computer as well, with two E-series multifunction I/O cards (one for each test station) and two instances of the same LabView program for acquiring and analysing the data. The DAQ computer has a Celeron processor w/ 850Mhz clock and 512MB memory, and is running on Windows NT.
    I have noticed that when I run both the applications simultaneously, I take a substantial performance hit in terms of processing speed (as opposed to running just one program). Why does this happen and how can I prevent it? (In t
    his particular case, it may be possible to combine both the tests into one program since they are identical, but independant, simultaneous control of two different LabView programs is a concept I need to prove out).
    Thanks in advance for any tips, hints and spoon feedings (!)....

    Depending on your application, you may or may not be able to improve things.
    Firstly, each task requires CPU time, so a certain performance difference is guaranteed. Making sure you have a "wait until ms" in every while loop helps in all but the most CPU intensive programs.
    Secondly, if you are
    1) streaming data to disk
    2) Acquiring lots of data over the PCI bus
    3) Sending lots of data o ver the network
    you can have bottlenecks elsewhere than in your program (limited Disk, PCI or Network bandwidth).
    Avoid also displaying data which doesn`t need to be displayed. An array indicator which only shows one element still needs a lot of processing time if the array itself is large.... Best is to set the indicator invisible if this is the case.
    I think
    it would be best if you could give some more information about the amount of data being acquired, processed and sent. Then maybe it will be more obvious where you can optimise things. If you are running W2000, try activating the task manager while the program(s) are sunning to see where the bottleneck is.
    Shane
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • How can I open two windows from one submit?

    Is there a way to open two browser windows from one click of a button to submit a form? I have a button on a screen that does some processing of the data and then generates a PDF file with the output. I would also like it to run a report and show the output of that in a separate window. I realize that using regular HTML with a target of "_blank" on the form, you can have the results show in a new window, but how can I launch a second window from a single button click, if possible?
    Thanks!

    It can be possible using two different popUps instead windows. Onclick on the button just make vissible true of those two popup in the event method, before making visible true, do the business operation to show on the popups. So simple :)
    Note: Popup has modal=false attribute
    Edited by: man_ish on Jan 12, 2010 10:13 AM

  • How do I run two tomcat on one webserver

    How Do I configure webserver to run two tomcat server.
    thanks

    make sure u have two seperate directories for tomcat.
    then edit one of the server.xml file and change the following port numbers 8080,8443,8009,8082 and 8081 to which ever port number u wish the second tomcat to run.
    For load balancing and fail safe settings, u will have to look at the documentation as this involves further settings to take care of
    good luck

  • How can I merge two iTunes folder, one with music and the other without?

    Two years ago Apple support suggested moving my iTunes folder out of my Home folder to the HD level in order to share it across users. This is no longer necessary. How do I move my music back to my Home folder since now I have an Itunes folder at the HD level (along with application, library, system, users folders) and an Itunes folder under Music in my Home folder. For example both those itunes folders have a mobile application, album artwork, and previous itunes library subfolder as well as itunes library extras.itdb and itunes library genius.itdb. How do I merge them or which ones do I delete? The files in the mobile app folder in my Home folder have a newer "last modified" date. Currenty under Itunes-->Preferences-->Advanced, it says Itunes media location is /itunes/itunes media/ music. I assumes that is the HD level folder. What happens if I hit reset?
    I am using Itunes 10.6.3.
    Any help tailored to a novice would be great. Thanks.

    Thanks for the links, Limnos.
    If you are willing to continue helping, here's what I found.
    Just to clarify the two iTunes folders I am refering to are:
    username-->Music-->iTunes
    HD-->iTunes
    I am presuming each location has a full set of files as outlined in the above links?
    Not all the files are in both locations. Most are.
    - The Itunes folder in my home folder does not have itunes library.xml.
    - The Itunes folder in my home folder has a subfolder called Mobile Applications (username-->Music-->iTunes--> Mobile application). The Itunes folder at the HD level also has a Mobile Application folder but it is a subfolder of Itunes Media folder (HD-->iTunes--> iTunes Media-->Mobile applications) and has no files in it.
    - I do not have an iTunes Media in the iTunes folder in my home folder.
    - also the Itunes media folder (HD-->iTunes--> iTunes Media) has subfolders by type (books, movies, itunes u, music etc...) but the iTunes Media-->Music also has some of the same subfolders ( iTunes Media-->Music-->books, iTunes Media-->Music-->Movies, iTunes Media-->Music-->iTunes U). Is this normal repetition?
    You say:
    /itunes/itunes media/ music
    but it is important to note what comes before all that.
    There is nothing as far as I can tell before that first forward slash. Since the only iTunes Media folder I have is in the iTunes folder that resides at the HD level (HD-->iTunes--> iTunes Media folder) not the iTunes folder in my home folder (username-->Music-->iTunes) , I assume that's the one that holds the music.
    Keep iTunes media folder organized and Copy files to iTunes Media folder when adding to library are both checked on
    Does that give more clarity into my problem?

  • How can I run two different versions of Firefox, the latest does not work with an important site I need to use?

    With the latest version of Firefox I cannot send "Quick Mails" to my students using the college's ANGEL system. I had to uninstall it and go to an earlier version. I prefer the newest rev.
    Any way to run two different versions. It does not have to be simultaniously. Seems to be a problem on both my Mac and XP systems.
    Thanks,
    Kim

    Currently I don't think there is a way to run two version of firefox at the same time. But you can install Firefox Beta or Aurora instead (which is build for future release for firefox) and help test it! Here's the link:
    http://www.mozilla.org/en-US/firefox/channel/

  • How can I run two instances of apache tomcat in the same machine.

    Hi
    Can I run 2 instances of apache tomcat in the same machine.If yes then how.?

    Yes, you can. Just run 2 instances. Make sure that they run on different ports.

  • How do i run two queries in one worksheet?

    Hi
    I am new to Disco and am finding some things easy to fathom and others not so.
    I have a table with fields
    callref
    logdate
    closedate
    I want to be able count the number of calls logged each month/year and the number of calls closed.
    So, I want to do 2 counts, each count applying a slightly different condition. I would then end up with data along the lines of:
    Month, Number Logged, Number Closed
    which I could then turn into a graph.
    I am assuming there must be an obvious way ...
    Sapphie
    Edited by: user12160673 on Feb 8, 2010 8:49 AM

    Hi Lee
    There's a couple of ways of doing this. I think the simplest would be create two calculations, one for Number Logged and one for Number Closed.
    For Number Logged presumably this is just the count of all rows returned in the worksheet? You can use COUNT(ROWNUM) for that calculation.
    For the Number Closed you only want to count those that have a closedate - yes? If so, this will work:
    SUM(CASE WHEN closedate is NOT NULL THEN 1 ELSE 0)
    Another way to do this, would be to create two analytic calculations, one for each count. The syntax for an analytic count is as follows:
    COUNT(item) OVER (filters)
    The item will be the thing you are counting. The filters can be left empty, in which case the count will be determined by all rows in the worksheet. If you want the count to be only on a subset of the rows then you need to provide one or more filters. Typical filters are page items and group sorted items.
    An example of a count over the whole query is:
    COUNT(callref) OVER ()
    Best wishes
    Michael

  • How can I put two photos in one 6x4 print??

    Hello!! So I want to print out some of my photos for a scrapbook.
    I however do not want them all to be 6x4 sized prints and making smaller ones (scrapbook prints) at the photo shops cost too much.
    There HAS to be a way to just put two separate photos into one photo jpeg type file right? That way I can print them out normally and just cut them in half so some are smaller?
    Any help?
    Much appreciated!

    Your question is not clear
    do you want to
    1 - put two separate photos into one photo jpeg type file
    Or do you want to print two photos on one sheet of paper so you can
    2 - can print them out normally and just cut them in half so some are smaller
    For 1 you need an external editor - you can do it in pages for example
    for 2 you simply select the two photos, crop them so they will fit and print selecting the printer, paper size and print size (slightly smaller than 3x4 since there needs to be a small border around them and between them), if the priview does not show two photos on the page click customize and in setting select multiple photos per page - the preview will reflect this selection and finish printing
    LN

  • Can you run two iphones on one account

    Can you ? Two phones sync on one account .

    I have two iPhones and daughters basic cell on a family plan here in US (AT&T). Each iPhone requires it's own data plan (charge) to be applied to the one account (bill).
    But I would say call the cell provider as they are the ones that provide service for the phone, while Apple is about the hardware. We all here are users and can tell you what we think or heard or experienced but only fact can come from the provider.
    Message was edited by: DaVBMan

  • How can I draw two matrixes in one graph???

    I have to draw two matrixes in one graph.
    Matrix size is 10 X 100, 10 X 100.
    Help me!
    Have a good day!

    You can do this by adding multiple plots to the graph's plots collection and then plotting each matrix on its own plot. The easiest way to add additinal plots to a graph's plots collection is to right-click on the graph in the dialog editor, click on Properties, click on the Plots tab, and then click the Add button to add additional plots.
    Now if you have a member variable for the graph in your dialog class (let's call it m_graph for this example), you could do this:
    // Plot the first matrix
    m_graph.Plots.Item(1).PlotXY(/* Your first 10x100 matrix data */);
    // Plot the second matrix on a different plot, but same graph
    m_graph.Plots.Item(2).PlotXY(/* Your second 10x100 matrix data */);
    - Elton

  • HELP!!! How can I put two phones on one comp??

    So here's the deal, my mom bought an iPhone yesterday and I plugged it into the computer and entered HER account information. Including her appleID & everything. Both of our phones are named differently as well. Then I put some of the apps that I had in the library that I thought she would want.  Then when she went to download a new app herself on her phone, it asked for my appleID password instead of hers?! How can I fix this??

    You will need to reset her phone but from a new user account on the computer for her exclusive use, her own iTunes library, etc. She can use her own Apple ID but she will need to purchase her own apps.
    Create a new user account on the computer for her to use. Then sync her iPhone with iTunes in her account. This will essentially remove everything from her phone - like a reset. She can then populate her iTunes, iCal, Address Book, etc. Once that's done resync her phone.
    Please Get the iPhone User Manual for iOS 5

  • How can i run two firefox's so i can have both my face book acounts open at the same time without one logging in to the other

    as you can see, im trying to have two firefox windows open so i can have both my facebook accounts open at the same time on the same pc
    all i get just now is they both log in to there user but ass soon as the page refreshes one drops its user and logs into the other

    Try of of these extensions for multiple cookie sessions.
    Multifox: <br />
    http://br.mozdev.org/multifox/ <br />
    Cookie Swap extension: <br />
    https://addons.mozilla.org/firefox/3255/ <br />
    Cookie Pie extension: <br />
    http://www.nektra.com/oss/firefox/extensions/cookiepie/

Maybe you are looking for

  • Unable to provide input value to InfoObject in SEM-BCS

    Hello BI Experts, I have created an infoobject 'ABC' in BI and have flagged 'With Master Data' and 'With Text'.  This infoobject has an navigational attribute 'XYZ'(XYZ also has 'With Master Data' and 'With Text'). When I go to T.Code UCWB(BCS Workbe

  • Camera in not found after Yosemite upgrade.

    2012 Macbook Pro Things we have already tried. (Several times) First - find out if the computer recognizes the camera. Check System Profiler (in the Utilities folder, inside the Applications folder). Under the USB header, check to see if the iSight c

  • Problem exporting in 16.9

    I am trying to export a short film in 16.9, its no propblem to do as a large file but I need to have it as a smaller file. Less than 150g. So when I select in export using qt, chose my codec, everything is fine, but when I select encode for broadband

  • ADF Bindings Factory

    I am new to ADF and am developing an application that will be used to edit PL/SQL rules. The application consists of four .jspx pages. Login and Failed Login and then a search page with the results conditionally displayed on the same page and an edit

  • My iPad is telling me that Facebook app is loaded but no app is there. How do I get it back?

    I changed over from an iPad 2 to iPad Air through the use of iCloud. My Facebook app is listed on my settings page as if the app exists but their is no icon to tap to enter the app. It will not allow me to delete it off the settings page but I can al