develooper Front page | perl.dbi.oracle-oci | Postings from March 2003

FW: bulk binds with OCI

Thread Next
From:
John Lien
Date:
March 27, 2003 13:09
Subject:
FW: bulk binds with OCI
Message ID:
CIENKNOFBOEJDAHEFIAIMEOAEGAA.jlien@friedwire.com

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:Tim.Bunce@pobox.com]
Sent: Thursday, March 27, 2003 2:56 AM
To: John Lien
Cc: oracle-oci@perl.org
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.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About