Need clarification on doing bulk updates

Hi All,
I got a requirement where I need to insert around 100 Million records and do updates on the entire content of the table.
Requirement is I have a customer order table as given below
CREATE TABLE customer_order(group_no number, order_no number) nologging no compress parallel 10;
This is going to have millions of rows (100 Million ).
When we are inserting the data we are inserting only order_no.
After insertion we need to update the group_no for all these orders. Here every 1000 order_no should have one group_no assigned to it. But when are picking up the 1000 order_no's those 1000 should be randomly picked up from the table and fors those 1000 orders we need to assign group no.
We are able to insert 100 Million rows into this table in under 5 minutes. (FYI there are no indexes on this table as we found indexes are of no use here and creation of indexes itself is taking more than 3 hours and the index size is greater than table size).
To get the random order numbers when are using DBMS_RANDOM..VALUE package it is taking for ever. Can anyone let us know how to tackle this challenging situation.
Appreciate your inputs here.
Thanks,
Maddy.

Do you need exactly 1000 order_no per group_no? If close enough is good enough I'd use:
INSERT
  INTO customer_order
  SELECT  ora_hash(level,100000 - 1),
          level
    FROM  dual
    CONNECT BY level <= 100000000
/For example:
SQL> CREATE TABLE customer_order(group_no number, order_no number)
  2  /
Table created.
SQL> INSERT
  2    INTO customer_order
  3    SELECT  ora_hash(level,10 - 1),
  4            level
  5      FROM  dual
  6      CONNECT BY level <= 10000
  7  /
10000 rows created.
SQL> select  group_no,
  2          count(*),
  3          min(order_no),
  4          max(order_no)
  5    from  customer_order
  6    group by group_no
  7  /
  GROUP_NO   COUNT(*) MIN(ORDER_NO) MAX(ORDER_NO)
         1       1001             4          9992
         6        991             2          9999
         2        989             6          9995
         4        989            18         10000
         5       1028            37          9996
         8       1006             5          9990
         7       1021             1          9988
         3        973            10          9998
         9        985             3          9977
         0       1017             8          9986
10 rows selected.
SQL> As you can see number of order_no per group no is close enough to 1000 and order_no within group_no are mixed (not sequential). And in any case, it would be more efficient to populate both order_no and group_no in single insert and then, if you need exact count per group no, issue smaller update.
SY.

Similar Messages

  • How can I do a bulk update?

    Hi
    In our BC4J application I need to perform a "bulk update", that is, I need to iterate over all the rows of a View and set one attribute on each one. Tracing the SQL session, I note that the BC4J framework is doing a select for update where pk = ... for each row. Is there something similar to the "executeQuery" view method, that does a "select for update"? something like an "executeQueryAndLockAllRows()?"
    I'm using PESSIMISTIC locking mode.
    Thanks,
    Ramiro

    Hi
    In our BC4J application I need to perform a "bulk update", that is, I need to iterate over all the rows of a View and set one attribute on each one. Tracing the SQL session, I note that the BC4J framework is doing a select for update where pk = ... for each row. Is there something similar to the "executeQuery" view method, that does a "select for update"? something like an "executeQueryAndLockAllRows()?"You can use batch-update features on an entity for update if your entity does not contain any refresh-on-update flags and any large data types (lobs). See help on Batch Update in the Tuning panel of an entity wizard/editor.
    It will still execute select..for..update but the network roundtrip will occur in a batch rather than one roundtrip for every row leading to a much faster batch-update performance.
    I'm using PESSIMISTIC locking mode.
    Thanks,
    Ramiro

  • How does one update Flash? I currently cannot watch videos on You Tube, it says I need to upgrade, I have no problem doing this on a PC.

    How does one update Flash? I currently cannot watch videos on You Tube, it says I need to upgrade, I have no problem doing this on a PC.

    If you're not using chrome you can just go to adobe's website (http://get.adobe.com/flashplayer/) and download the newest flash player.  You run the .dmg and then open the application, which updates flash.  With the latest version of flash there should be a preference pane within system preferences to allow you to change settings and check for updates.

  • HT1277 Mail on my Mac computer does not update when I update my mail on my phone and iPad.  Can anyone help me with this?  Is there a setting I need to check?

    Mail on my Mac computer does not update when I update my mail on my iPhone and iPad. Can anyone help me with this?  Is there a setting that I need to check?

    All that you had to do was to sign into the old account in order to update those apps. What I mean is that you just needed to sign into that account in the store settings like I described and that should have worked. You didnt need to enter the credit card information again - you justed needed to use the old ID and password.
    Anyway, I think the good news is that if everything else is OK with the new account, just download iBooks with the new ID - it's a free app so its not like you have to pay for it again. I'm not sure what the other App is that you are talking about - but if it is the Apple Store App - that is free as well.
    Try this anyway, when you try to update iBooks, just use the old password if the old ID still pops up.
    Did you try signing into the store settings with your new ID and see what happens with the updates then?

  • My project need to be saved as a Video_TS/Audio_TS file for burning purposes with a company that does bulk burring. how do i go by this?

    my project needs to be saved as a Video_TS/Audio_TS file for burning purposes with a company that does bulk burring. how do i go by this?

    VIDEO_TS (and an empty audio_ts) folders are part of a standardised DVD structure.  So, what you need a DVD-authoring tool.  FCPX offers to create a very simple DVD, one movie, two designs (black or white), no menu, done.  Older Macs came pre-installed with iLife/iDVD  … export your project as a 'Master', drag into iDVD, select any design template ...   Apple axed 'disk creation' about 7 years ago ... the AppStore is crowded with other, convenient, consumer, template based  tools. Professional structured DVDs are only optional with obsolete DVDSP (part of FC-suite) or Adobe Encore .....

  • My itunes need a update and i pluged in my ipod awhile doing the updat now my ipod won't turn on and the screen has a itunes ion on it what should i do

    my itunes need a update and i pluged in my ipod awhile doing the updat now my ipod won't turn on and the screen has a itunes ion on it what should i do? i really need the help

    Try:                                               
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable       
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar                                     

  • Hi.  I iMac, Mac OS X 10.6.8  Lately it does not update the program.  Writes the following: "Unable to install the update iTunes. An unexpected error occurred." What you need to do that right, that programs can be updated again?

    I iMac, Mac OS X 10.6.8  Lately it does not update the program.  Writes the following: "Unable to install the update iTunes. An unexpected error occurred." What you need to do that right, that programs can be updated again?

    you will have the most up to date itunes available for your os 10.6.8. to get a newer version you will have to upgrade to a newer os.

  • HT2128 I need to open a firmware update to my rinter and Photoshop 'does not recognize this firle' is what I get. what can I do?  J. dunn

    I need to download some firware  update from the internet.  Photoshop says it does not recognize this file and will not open it.  what should I do??? thanks, Judi

    I downloaded a Lexmark firmware update file for a color laser printer, just to see what it contained.
    It downloaded as a .zip file.
    I double-clicked the .zip file to un-zip it. (Sorry, I'm not sure which program actually did the unzipping.)
    Once unzipped, it contained several files for multiple operating systems, including Windows and OS X.
    Double-clicking on the PrinterFileLoader.dmg should start the installation on your Mac.
    Opening the README Updating firmware.pdf file and selecting the Mac section revealed:
    *There were additional images on this page that I couldn't capture with a screenshot.
    Your firmware update README file should contain similar information.
    Message was edited by: kostby

  • I need to change my account name but even if I updated it in the Adobe website, Revel still does not update my name at all! ***Urgent***

    I need to change my account name but even if I updated it in the Adobe website, Revel still does not update my name at all! ***Urgent***

    Good morning,
    Glad your account is up and running!
    As a note, the Revel service is not going away any time in the near future. The apps that are no longer available as of Dec. 8 are Grouppix and VideoBite
    Glenyse

  • When I sync my iPad with iTunes it does not update the play count?  Is there a setting I need to change?

    When I sync my iPad with iTunes it does not update my play counts.  Is there a way to make this happen?

    Are you using iTunes Match by chance?  I had no problems whatsoever with play counts synching between any of my devices until I started using iTunes Match.  I turned it off and magically my play counts synced.  Once. Hasn't happened again though. 

  • Bulk update height of Hyperlinks in a PDF document

    When we export our InDesign document to PDF, hyperlinks are automatically generated for each item in the Table of Contents (TOC). This is great, but the problem is the hyperlink area of each line overlaps with the hyperlink area of the next line. This can create confusion in Adobe Reader and Apple Preview when a user clicks near the top or bottom of a TOC heading on a line, thinking it will take them to that heading in the document but instead they are taken to the preceeding or following heading in the document.
    We currently have to open the PDF up in Adobe Acrobat and manually go through and reduce the height of every hyperlink in our document, particularly in the TOC (using the Link Tool). Is there anyway in InDesign to change the height of hyperlinks that are exported? If not, is there a way to bulk update the height of all the hyperlinks using Acrobat rather than doing each one individually/manually (maybe some sort of script)?
    Many thanks : ) Lee

    Yes, you can create a script in Acrobat that loops through the links and adjusts the link's "rect" property to suit your needs. You'll want to consult the Acrobat JavaScript Reference, and look at the doc.getLinks method in particular: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.479.html
    along with the Link object properties: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.802.html
    Post again if you get stuck.
    I don't know what control you have over this on the InDesign side of things. You may want to ask in one of the InDesign forums if you haven't already.

  • BULK UPDATE

    Hi,
    I am trying to do Update in batches, but with very little success. I did some reading and tried using BULK COLLECT and FORALL to accomplish the task. I am not sure where I messed up but only one row is being updated. Also I am not sure if there is a better wasy of doing this.
    I am currently using 10.2.
    Any help would be appreciated. The goal is to update "temp_emp_new" based on "temp_emp_base".
    Create the base tables:
    CREATE TABLE temp_emp_base AS
    SELECT ROWNUM AS emp_id
         , SYSDATE - (365 * ROWNUM) AS emp_dob
      FROM all_objects
    WHERE ROWNUM < 11;
    COMMIT ;
    CREATE TABLE temp_emp_new
        emp_id NUMBER,
        emp_dob DATE
    INSERT INTO temp_emp_new
       SELECT emp_id
            , NULL AS emp_dob
         FROM temp_emp_base;
    COMMIT ;Try to update temp_emp_new based on temp_emp_base:
    DECLARE
       TYPE emp_id_tab IS TABLE OF temp_emp_new.emp_id%TYPE;
       TYPE emp_tab IS TABLE OF temp_emp_new%ROWTYPE;
       CURSOR emp_cur
       IS
          SELECT emp_id
            FROM temp_emp_new;
       t_emp_id       emp_id_tab     := emp_id_tab ();
       l_start           NUMBER;
       l_size            NUMBER            := 5;
       l_cnt             NUMBER            := 0;
       dml_errors        EXCEPTION;
       PRAGMA EXCEPTION_INIT (dml_errors, -24381);
    BEGIN
       l_start := DBMS_UTILITY.get_time;
       OPEN emp_cur;
       LOOP
          DBMS_APPLICATION_INFO.set_client_info ('processing ' || l_cnt || ' thru ' || (l_cnt + l_size));
          FETCH emp_cur
          BULK COLLECT INTO t_emp_id
               LIMIT l_size;
          BEGIN
             FORALL i IN t_emp_id.FIRST .. t_emp_id.LAST SAVE EXCEPTIONS
                UPDATE temp_emp_new mza
                   SET (mza.emp_dob) =
                          (SELECT NVL (mza.emp_dob, m.emp_dob) AS emp_dob
                             FROM temp_emp_base m
                            WHERE mza.emp_id = m.emp_id
                              AND m.emp_id = t_emp_id (i));
             COMMIT;
          EXCEPTION
             WHEN dml_errors
             THEN
                FOR i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT
                LOOP
                   DBMS_OUTPUT.put_line (   'Error occurred during iteration '
                                         || SQL%BULK_EXCEPTIONS (i).ERROR_INDEX
                                         || ' Oracle error is '
                                         || SQL%BULK_EXCEPTIONS (i).ERROR_CODE);
                END LOOP;
          END;
          EXIT WHEN t_emp_id.COUNT = 0;
          l_cnt := l_cnt + l_size;
       END LOOP;
       CLOSE emp_cur;
       DBMS_OUTPUT.put_line ('Bulk Updates   : ' || (DBMS_UTILITY.get_time - l_start));
       COMMIT;
    END;

    Managed to correct my mistake.
    I just thought about it a little more and got the answer. Actually I think it was just about taking a fresh look in the morning.
    Thanks for the suggestions anyways.
    DECLARE
    The table types and cursor are now created from "temp_emp_base".
    I am also creating a Table Type for the column whose values I need for the UPDATE.
       TYPE emp_id_tab IS TABLE OF temp_emp_base.emp_id%TYPE;
       TYPE emp_dob_tab IS TABLE OF temp_emp_base.emp_dob%TYPE;
       TYPE emp_tab IS TABLE OF temp_emp_base%ROWTYPE;
       CURSOR emp_cur
       IS
          SELECT emp_id, emp_dob
            FROM temp_emp_base;
       t_emp_id                      emp_id_tab := emp_id_tab();
       t_emp_dob                     emp_dob_tab := emp_dob_tab();
       l_start                       NUMBER;
       l_size                        NUMBER := 5;
       l_cnt                         NUMBER := 0;
       dml_errors                    EXCEPTION;
       PRAGMA EXCEPTION_INIT(dml_errors, -24381);
    BEGIN
       l_start := DBMS_UTILITY.get_time;
       OPEN emp_cur;
       LOOP
          DBMS_APPLICATION_INFO.set_client_info('processing ' || l_cnt || ' thru ' ||(l_cnt + l_size) );
          FETCH emp_cur
          BULK COLLECT INTO t_emp_id, t_emp_dob LIMIT l_size;
          BEGIN
      The UPDATE statement updates "temp_emp_new" and the BULK COLLECT
      has the data from "temp_emp_base"
             FORALL i IN t_emp_id.FIRST .. t_emp_id.LAST SAVE EXCEPTIONS
                UPDATE temp_emp_new mza
                   SET mza.emp_dob = NVL(mza.emp_dob, t_emp_dob(i) )
                 WHERE mza.emp_id = t_emp_id(i);
             COMMIT;
          EXCEPTION
             WHEN dml_errors THEN
                FOR i IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP
                   DBMS_OUTPUT.put_line('Error occurred during iteration '
                      || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX
                      || ' Oracle error is '
                      || SQL%BULK_EXCEPTIONS(i).ERROR_CODE);
                END LOOP;
          END;
          EXIT WHEN t_emp_id.COUNT = 0;
          l_cnt := l_cnt + l_size;
       END LOOP;
       CLOSE emp_cur;
       DBMS_OUTPUT.put_line('Bulk Updates   : ' ||(DBMS_UTILITY.get_time - l_start) );
       COMMIT;
    END base;

  • Bulk Update Validation

    Is it possible to keep the latest changes to fields user makes on bulk updatable forms when submit fails because of one field validation. For example, if I'm checking one of the field 'x' to be correct email address, also user might have changed some other fields, so if the validation fails on field x while submitting, then it will erase the latest changes in other fields also. Is there way we can avoid this?.
    Thanks,
    Surya

    Thanks for quick reply Scott. Right, it's multi-row updateable reports and trying to preserve the values. I'm not uisng the wizard to generate the updateable report, because the of conditional columns. There was known issue with bulk updates, if the updateable columns are conditional. Here is the description of the page.
    1. Region
    1. Page with a region sql query(updatetable report) contains about 40 columns and columns are conditionally dispalyed. These condinal columns condtions are set in "report atrributes". I've created this region with my own select statement. The region display and conditions works fine.
    2. Process
    I've written a corresponding process to update the table, this works fine.
    3. Validation
    Type : function returning boolean
    when submit button is pressed
    validation :
    DECLARE
    v_error_flag BOOLEAN := TRUE;
    BEGIN
    FOR i IN 1 .. wwv_flow.g_f01.COUNT LOOP
    IF i BETWEEN wwv_flow.g_flow_current_min_row AND
    wwv_flow.g_flow_current_min_row + wwv_flow.g_flow_current_max_rows THEN
    IF (wwv_flow.g_f02(i) IS NULL) THEN
    v_error_flag := FALSE;
    END IF;
    END IF;
    END LOOP;
    RETURN v_error_flag;
    END;
    basically the above condition checking for wwv_flow.g_f02(i) is null or not and returning true or false. The error message will be displayed inline with field and notification. The validation works fine, but does not retain values of the validation field and other fields also, this is the main problem.
    4. branch
    onsubmit: After processing(after computation,validation and branching)
    branch to page or url and using the page number.
    Please let me know if you need any further information. I've an example page in my application, incase if you want to take a closer look at it. Any quick help is really appreciated.
    thanks,
    Surya

  • No Data Found Exception in bulk updates

    I am trying to catch no data found exception in bulk updates when it does not find a record to update in the forall loop.
    OPEN casualty;
    LOOP
    FETCH casulaty
    BULK COLLECT INTO v_cas,v_adj,v_nbr
    LIMIT 10000;
    FORALL i IN 1..v_cas.count
    UPDATE tpl_casualty
         set casualty_amt = (select amt from tpl_adjustment where cas_adj = v_adj(i))
         where cas_nbr = v_nbr(i);
    EXCEPTION WHEN NO_DATA_FOUND THEN dbms_output.put_line('exception')
    I get this error at the line where i have exception:
    PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:
    begin case declare end exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe
    Can someone pls direct me on how to get around this?
    If I do not handle this exception, the script fails when it attempts to update a record that does not exist and the error says : no data found exception.
    Thanks for your help.
    Edited by: user8848256 on Nov 13, 2009 6:15 PM

    No Data Found isn't an exception raised when an UPDATE cannot find any records to process.
    SQL%ROWCOUNT can be used to determine the number of rows affected by an update statement, but if 0 rows are updated then no exception will be raised (it's just not how things work).
    If you post your actual CURSOR (casualty) declaration, it's quite possible we can help you create a single SQL statement to meet your requirement (a single SQL will be faster than your current implementation).
    Have you looked in to using the MERGE command?

  • Hello everybody, I need to update my ITunes on my MAC (laptop) to the newer version so I can then be able to update the latest updates for my Iphone-3G'S. I don't require a complete reinstall just need to be able to update it.What I have tried so far is I

    Hello everybody, Im trying to update my ITunes on my MAC (laptop) to the newer version so I can then be able to update the latest updates for my Iphone-3G. I don’t require a complete reinstall just need to be able to update my itunes.
    What I have tried so far is I had my MAC search for update’s and it said that I should update to (ITunes version  10 . 6 . 3 ) So I asked it to do the update but after 2hrs of waiting for it to download/update it then puts up a message saying the following- (In order to continue installation, please close the following application: ITunes).
    When I tried to do this another message comes up that says- (The update ITunes can’t be installed. The following install step failed: run preupgrade script for Apple mobile device support. Contact the software manufacturer for assistance.)
    I have also tried to run the update while having closed ITunes before I even start the update but the same problem happens after waiting about 2hrs.
    Some one that had the same problem said this might be happening in the older operating systems. But that does not make sense because surely Apple want customers who own a MAC and i-phone to still buy from iTunes.
    My MAC is about 4-5years old. I have a i-phone.3G, 
    Can anybody help me please and Thank you?

    Download iTunes using the tab at the top of this page. Then run the update with iTunes closed.

Maybe you are looking for

  • Timeout when consuming a SOAP web service

    Hello, I'm quite new to Labview and I'm trying to consume a SOAP web service created using a very simple WCF example, but I keep on getting a WebException because of a timeout. The web service has been created using the example from the WCF getting s

  • Service Order Planned Costs and Cost Center Planned Line Items

    Experts, I am curious of Service Order Planned costs, and whether or not these planned costs are being posted to the Cost Center linked to the Service Order Operation's work center. I am a but puzzled as I don't see any planned costs from any Service

  • Portal is down

    Hi all, I using oracle app server 9.0.4.2 from the application server control , the middle tier instance is down, all it's components are up exept for the Portal:portal! when I entered its page I found that , Syndication Services and the Ultra Search

  • Firefox home page doesn't open when I click on Firefox. Have to go to File and click on New Window to get into Start Page.

    Firefox doesn't open when I click on it. I have to click on New Window under File to get my bookmarks and a search page == This happened == Every time Firefox opened == No way to know. Nothing new has been done to Firefox.

  • Initiate a Process with Message Event

    I want to intiate a BPM process on trigger from Workflow adapter, initiateTask method...what changes/customizations do i need to do into the Oracle BPM 11g