Re: [DBD::Oracle] ORA-02005 on array insert

"Peter J. Holzer" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On 2012-03-20 08:24:36 -0400, John Scoles wrote:
> 
> Ran into that one, or nearly like it, a while back.  Was not able to find a OCI/DBD solution so I just modified my code like this
>  
> $sth->execute_array({},\ @undefs, \@undefs, \@data_ids, \@set_ids, $ct_none);
> 
>  so I had an array for each param

That was the first workaround I tried. Unfortunately it didn't help. 

The workaround we use now (well, one could argue that it is actually
clearer than the original code) is that we omit columns which aren't
needed. So in this in this case we have:

    my $sth = $dbh->prepare_cached("insert into $table(data_id, set_id, coordtype)
    values(?, ?, ? )");
    
    $sth->execute_array({}, undef, undef, $data_ids, \@set_ids, $ct_none);

instead of

    my $sth = $dbh->prepare_cached("insert into $table(period_start, period_end, data_id, set_id, coordtype)
    values(?, ?, ?, ?, ? )");
    
    $sth->execute_array({}, undef, undef, $data_ids, \@set_ids, $ct_none);

(One interesting thing is that $ct_none is also undef, but that doesn't
seem to be a problem).

        hp


-- 
   _  | Peter J. Holzer    | Auf jedem Computer sollte der Satz Ludwigs II
|_|_) | Sysadmin WSR       | eingeprägt stehen: "Ein ewig Rätsel will ich
| |   | [email protected]      | bleiben, mir und andern."
__/   | http://www.hjp.at/ |    -- Wolfram Heinrich in desd
signature.asc (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iD8DBQFPaJHYMdFfQa64PCwRAhRFAJ9WZttAVoPkCNP35tYb0qYgJ8jVxQCgivGv
TJkXPKjlgNpU31FbdOaOZoo=
=zUoe
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.