http://www.perlmonks.org?node_id=1071905


in reply to DBI Oracle Input Array Binds

You might be better off posting this to the dbi-users mailing list as other than tux I don't think any of the other DBI/DBD maintainers hang around here much.

That error message comes from Driver_xst.h in DBI which is included in every DBD:

static int dbdxst_bind_params(SV *sth, imp_sth_t *imp_sth, I32 items, I32 ax) { /* Handle binding supplied values to placeholders. */ /* items = one greater than the number of params */ /* ax = ax from calling sub, maybe adjusted to match items */ dTHX; int i; SV *idx; if (items-1 != DBIc_NUM_PARAMS(imp_sth) && DBIc_NUM_PARAMS(imp_sth) != DBIc_NUM_PARAMS_AT_EXECUTE ) { char errmsg[99]; /* clear any previous ParamValues before error is generated */ SV **svp = hv_fetch((HV*)DBIc_MY_H(imp_sth),"ParamValues",11,F +ALSE); if (svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { HV *hv = (HV*)SvRV(*svp); hv_clear(hv); } sprintf(errmsg,"called with %d bind variables when %d are needed", (int)items-1, DBIc_NUM_PARAMS(imp_sth)); DBIh_SET_ERR_CHAR(sth, (imp_xxh_t*)imp_sth, "-1", -1, errmsg, +Nullch, Nullch); return 0; }

I don't much like the look of that I32 having 1 subtracted from it and then cast to an int but I cannot see how 3443804 was arrived at right now.

Perhaps the tail end of a DBD::Oracle trace when this happens might help. Run your code again with DBI_TRACE=15=x.log set and exported and show us the tail end of the x.log file.

As I said, you'll probably do better on dbi-users mailing list but they are bound to ask for versions of perl, DBI, DBD::Oracle, Oracle, Oracle client and the log file I suggested you provide.

Replies are listed 'Best First'.
Re^2: DBI Oracle Input Array Binds
by hhferreira (Initiate) on Jan 24, 2014 at 10:14 UTC

    Thanks for your reply!

    Here is the output of dbi_trace=15:

    bd_rebind_ph_varchar2_table(): Copying length=1 array[1558]='N'. dbd_rebind_ph_varchar2_table(): Copying length=1 array[1559]='N'. dbd_rebind_ph_varchar2_table(): Copying length=1 array[1560]='N'. dbd_rebind_ph_varchar2_table(): Copying length=1 array[1561]='N'. OCIBindByName(b877a34,c2e3b5c,b8724c8,":in_testdefs",p +laceh_len=12,value_p=dd5d418,value_sz=2,dty=5,indp=dcaf908,alenp=dbc6 +708,rcodep=0,maxarr_len=1562,curelep=c2e3b90 (*=1562),mode=DEFAULT,0) +=SUCCESS OCIOCIBindArrayOfStruct(b90a14c,b8724c8,2,2,2,0)=SUCCE +SS OCIAttrGet(b90a14c,OCI_HTYPE_BIND,c2e3b48,0,31,b8724c8 +)=SUCCESS dbd_rebind_ph_varchar2_table(): bind :in_testdefs <== ARRAY(0xdc7adc0) + (in, not-utf8, csid 1->0->1, ftype 201, csform 0 (0)->0 (0), maxlen +2, maxdata_size 0) OCIAttrSet(b90a14c,OCI_HTYPE_BIND, ffa5e998,0,Attr=31, +b8724c8)=SUCCESS rebind :in_testdefs done with ftype 201 (ORA_VARCHAR +2_TABLE) <- bind_param= ( 1 ) [1 items] at /mycode/start/..ComponentSet.pm +line 400 via at /mycode/start/..ComponentSet.pm line 877 {{ execute callback CODE(0xb832be8) being invoked 1 -> FETCH for DBD::Oracle::st (DBI::st=HASH(0xd077218)~INNER 'Param +Values') thr#8916008 1 <- FETCH= ( HASH(0xd0758e8)7keys ) [1 items] at /mycode/start/..DB +Conn.pm line 301 via at /mycode/start/..ComponentSet.pm line 402 }} execute callback CODE(0xb832be8) returned -> execute for DBD::Oracle::st (DBI::st=HASH(0xd39bbf0)~0xd077218) + thr#8916008 !! ERROR: -1 'called with 11541898 bind variables when 7 are neede +d' (err#0) <- execute= ( undef ) [1 items] at /mycode/start/..ComponentSet.pm + line 402 via at /mycode/start/..ComponentSet.pm line 877 >> FETCH DISPATCH (DBI::st=HASH(0xd077218) rc2/1 @2 g2 ima40 +4 pid#30775) at /mycode/start/..ComponentSet.pm line 402 via at /myc +ode/start/..ComponentSet.pm line 877 1 -> FETCH for DBD::Oracle::st (DBI::st=HASH(0xd077218)~INNER 'Param +Values') thr#8916008 ERROR: -1 'called with 11541898 bind variables when 7 are neede +d' (err#0) 1 <- FETCH= ( HASH(0xd39f058)7keys ) [1 items] at /mycode/start/..Co +mponentSet.pm line 402 via at /mycode/start/..ComponentSet.pm line 8 +77 -> HandleError on DBI::st=HASH(0xd077218) via CODE(0xb832ab8) (und +ef) >> can DISPATCH (DBI::st=HASH(0xd39bbf0) rc1/6 @2 g2 ima10 +0 pid#30775) at /mycode/start/..Dumper/HumanReadable.pm line 130 via + at /mycode/start/..Dumper/HumanReadable.pm line 259 <- can(dump) = 0 (? 0) >> can DISPATCH (DBI::st=HASH(0xd39bbf0) rc1/6 @2 g2 ima10 +0 pid#30775) at /mycode/start/..Dumper/HumanReadable.pm line 130 via + at /mycode/start/..Dumper/HumanReadable.pm line 259 <- can(dumpKeyNames) = 0 (? 0) >> can DISPATCH (DBI::st=HASH(0xd39bbf0) rc1/6 @2 g2 ima10 +0 pid#30775) at /mycode/start/..Dumper/HumanReadable.pm line 130 via + at /mycode/start/..Dumper/HumanReadable.pm line 259 <- can(dumpKeyStyles) = 0 (? 0) >> can DISPATCH (DBI::st=HASH(0xd39bbf0) rc1/6 @2 g2 ima10 +0 pid#30775) at /mycode/start/..Dumper/HumanReadable.pm line 130 via + at /mycode/start/..Dumper/HumanReadable.pm line 259 <- can(dumpKeyComments) = 0 (? 0) >> can DISPATCH (DBI::st=HASH(0xd39bbf0) rc1/6 @2 g2 ima10 +0 pid#30775) at /mycode/start/..Dumper/HumanReadable.pm line 130 via + at /mycode/start/..Dumper/HumanReadable.pm line 259 <- can(asString) = 0 (? 0) >> FIRSTKEY DISPATCH (DBI::st=HASH(0xd077218) rc2/1 @1 g2 ima4 +pid#30775) at /mycode/start/..Dumper/HumanReadable.pm line 234 via a +t /mycode/start/..Dumper/HumanReadable.pm line 130 1 -> FIRSTKEY in DBD::_::common for DBD::Oracle::st (DBI::st=HASH(0x +d077218)~INNER) thr#8916008 ERROR: -1 'called with 11541898 bind variables when 7 are neede +d' (err#0) 1 <- FIRSTKEY= ( undef ) [1 items] at /mycode/start/..Dumper/HumanRe +adable.pm line 234 via at /mycode/start/..Dumper/HumanReadable.pm li +ne 130 >> FETCH DISPATCH (DBI::st=HASH(0xd077218) rc3/1 @2 g2 ima40 +4 pid#30775) at /mycode/start/..DBConn.pm line 365 via at /mycode/st +art/..DBConn.pm line 203 1 -> FETCH for DBD::Oracle::st (DBI::st=HASH(0xd077218)~INNER 'Raise +Error') thr#8916008 .. FETCH DBI::st=HASH(0xd077218) 'RaiseError' = 1 ERROR: -1 'called with 11541898 bind variables when 7 are neede +d' (err#0) 1 <- FETCH= ( 1 ) [1 items] at /mycode/start/..DBConn.pm line 365 vi +a at /mycode/start/..DBConn.pm line 203 -> DESTROY for DBD::Oracle::st (DBI::st=HASH(0xd077218)~INNER) thr +#8916008 dbd_st_destroy OCIHandleFree(b877a34,OCI_HTYPE_STMT)=SUCCESS ERROR: -1 'called with 11541898 bind variables when 7 are neede +d' (err#0) <- DESTROY= ( undef ) [1 items] at /mycode/start/../cpan/lib/Try/T +iny.pm line 90 via at /mycode/start/../cpan/lib/Try/Tiny.pm line 90

    PERL version: 5.12.1

    DBI version: 1.611

    DBD::Oracle: 1.21

    We have made a standalone script and it works perfectly even with 20000 entries per array. We are using perl objects all over the code, can this be a memory leak?!

    BTW, I will post in dbi-users as well. Thanks!

      I help maintain DBD::Oracle but I didn't write that bit of code.

      Unfortunately that log is too short to give me a clue.

      I'm pretty much the only person in the last 2 years who has changed the XS/C code and your best bet for getting a diagnosis and possible fix is a standalone example which demonstrates the problem. Unfortunately, it seems you've already tried this.