Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: When to use bulk bind?

RE: When to use bulk bind?

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Thu, 01 May 2003 11:31:41 -0800
Message-ID: <F001.0058DA6C.20030501113141@fatcity.com>


No rule of thumb (if you are doing something in a loop, see if you could *bulk* the operation), but for an example code like this

for I in array.first .. array.last
loop
  update some_table

     set some_column = array(i).value
   where other_column = array(i).column; end loop;

You'd benefit from using a bulk bind with FORALL.

forall i in array.first array.last
update some_table

   set some_column = array(i).value
 where other_column = array(i).column;

Syntax might change based on what version you are on ... but this should give you some idea.
It depends on your processing of data.

Raj




Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art !

-----Original Message-----
Sent: Thursday, May 01, 2003 2:57 PM
To: Multiple recipients of list ORACLE-L

We have a batch process that does a long series of updates, inserts, and deletes. Right now we are using a script to execute sql.

When is it appropriate to move this to PL/SQL and use array processing? couple of things I thought of...

  1. We have one large table that has a column with 5-6 distinct values. We are often doing

select stuff
from big_table
where column = 'BLAH'

Would it be a good idea to bulk collect the rowids or even just select the entire row into a pl/sql table? and essentially break the table up into 5 smaller tables?

then do a forall statement to do my update?

In general when should you move from update, insert,delete statements with sub-queries to array processing? anyone have any rules of thumb?

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: <rgaffuri_at_cox.net
  INET: rgaffuri_at_cox.net

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Jamadagni, Rajendra
  INET: Rajendra.Jamadagni_at_espn.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Received on Thu May 01 2003 - 14:31:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US