473,411 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Using FORALL with associative arrays

I have the following procedure:

TYPE testarray is table of int index by binary_integer;

PROCEDURE testfast(par1 in testarray) is
begin
FORALL i IN par1.FIRST..par1.LAST
insert into dummy (test) values (par1(i));
end;

This works, but is not a good solution with giant arrays, as the forall
puts all of it in memory. The obvious solution would be to use BULK
COLLECT and a LIMIT, but that only works with SQL types, and not with
PL/SQL collections, as far as I can tell.

Somewhat oddly, if I call the insert statement directly from my client
using array binding, the perfomance is as good as the procedure and it
scales well with large arrays.

I would think it should be possible to achieve the same performance and
scalability via a procedure, right?

I have to use an associative array, because that's the only collection
type currently supported by ODP.NET, unless I'm mistaken.

--
Tor H.
Nov 22 '05 #1
2 9931
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;
Nov 22 '05 #2
On Wed, 16 Nov 2005 13:57:43 +0100, Tor Hovland wrote:
Responding to myself here, as nobody else seem willing to :-)


Not necessarily unwilling. Perhaps not visible. Or perhaps just tired
of monitoring a defunct newsgroup that has limited circulation.

Had you spent a brief time looking for the charter for this news group (a
google search would have led you to OraFaq.com) you would have realized
that this group has been superceeded by comp.datases.oracle.server and
comp.databases.oracle.misc which are officially carried by newsgroup
servers (whereas carrying this one is totally optional).

/Hans
Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Eric Anderson | last post by:
Got a quick question trying to figure out the XSLT way of implementing the functionality of associative arrays. Basically want I want to do is the following: <xsl:template name="foo">...
27
by: Abdullah Kauchali | last post by:
Hi folks, Can one rely on the order of keys inserted into an associative Javascript array? For example: var o = new Object(); o = "Adam"; o = "Eve";
3
by: nkparimi | last post by:
Hi, I'm facing issues with using associative arrays in non-IE browsers. In particular, I have code like the following: var IDToAddress = new Array(); IDToAddress = 'apple tree lane, mars';...
41
by: Rene Nyffenegger | last post by:
Hello everyone. I am not fluent in JavaScript, so I might overlook the obvious. But in all other programming languages that I know and that have associative arrays, or hashes, the elements in...
11
by: Bosconian | last post by:
I'm trying to output the contents of an array of associative arrays in JavaScript. I'm looking for an equivalent of foreach in PHP. Example: var games = new Array(); var teams = new...
3
by: Robert Mark Bram | last post by:
Hi all, I have some code to iterate through nested associative arrays. Can anyone please tell me what I am doing wrong? :) var dealers = new Array(); var dealer1 = new Array(); dealer1 =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.