Re: Using FORALL with associative arrays

From: Tor Hovland <teh_at_nospam.com>
Date: Wed, 16 Nov 2005 13:57:43 +0100
Message-ID: <w_OdnXkhwZ-VsObe4p2dnA_at_telenor.com>


Responding to myself here, as nobody else seem willing to :-)

It finally dawned on me that I can simulate LIMIT by taking manual control over the FORALL range. The following procedure is a very performant and scalable way to push data into oracle.

   PROCEDURE testfast(par1 in testarray) is

     startPos int;
     endPos   int;
   begin
     startPos := par1.first;

     loop
       endPos := startPos + 100;

       if endPos > par1.last then
         endPos := par1.last;
       end if;

       FORALL i IN startPos .. endPos
         insert into dummy (test) values (par1(i));

       startPos := endPos + 1;

       exit when endPos = par1.last;
     end loop;

   end; Received on Wed Nov 16 2005 - 13:57:43 CET

Original text of this message