develooper Front page | | Postings from March 2003

FW: bulk binds with OCI

Thread Next
John Lien
March 27, 2003 13:09
FW: bulk binds with OCI
Message ID:

So there might be a DBD::Oracle equivalent for this PL/SQL

FORALL idx IN 1..rec_count
   INSERT INTO emp ( name_list(idx), title_list(idx) );

coming down the line that might be called like this:

$insert_sth->execute_array ( $aref_names, $aref_titles );

That would be cool.  My server and I would be more indebted to you than we
are already.


-----Original Message-----
From: Tim Bunce []
Sent: Thursday, March 27, 2003 2:56 AM
To: John Lien
Subject: Re: bulk binds with OCI

On Wed, Mar 26, 2003 at 03:44:17PM -0700, John Lien wrote:
> Hi.
> I've been using DBD::Oracle and DBI for a few years, but just discovered
> Oracle OCI module the other day.  Since then I've been poking around
> to learn more about it.
> My goal is to do bulk inserts from Perl.  (I dont believe you can do that
> from DBD::Oracle - let me know if I'm wrong.  I have seen references in my
> search results made to bind_param_array, but could never follow a thread
> an example.)
> So, can I do bulk inserts with Oracle::OCI?

In theory, but it wouldn't be fun!

DBD::Oracle, via execute_array(), would be easier to patch.
I may even get to it soonish, as hinted by this entry in the change
log for the next DBI release:

  Added on-demand by-row data feed into execute_array() using code ref,
    or statement handle. For example, to insert from a select:
    $insert_sth->execute_array( { ArrayTupleFetch => $select_sth, ... } )


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About