FW: bulk binds with OCI

[email protected] ("John Lien") Thu, 27 Mar 2003 14:08:36 -0700
Newsgroups perl.dbi.oracle-oci
Message-ID <[email protected]>
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.

-jkl

-----Original Message-----
From: Tim Bunce [mailto:[email protected]]
Sent: Thursday, March 27, 2003 2:56 AM
To: John Lien
Cc: [email protected]
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
the
> Oracle OCI module the other day.  Since then I've been poking around
trying
> 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
to
> 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, ... } )

Tim.