On Wed, 8 May 2013 09:30:18 -0700 Bill Ward <[email protected]> wrote: > My guess is that get_value() is returning an empty array rather than > an undef scalar when the values are null. Try copying each one to a > scalar variable and including the list of variables in the execute(). > It'd be more readable that way anyway. Or if you must put them all > one one line like this, add the scalar() function on each argument.
I use this idiom: ... get_value(...) || undef, ...get_value(...) || undef, ... If you don't want undef, you can use "|| ''" or "|| 0" instead. > On Wed, May 8, 2013 at 9:18 AM, Bruce Johnson > <[email protected]>wrote: > > > Getting the error: > > > > DBD::Oracle::st execute failed: called with 3 bind variables when 4 > > are needed [for Statement "insert into employee_fte_annualrate_l > > (emplid, emptype_cd, fte, annual_rate) values(?,?,?,?)" with > > ParamValues: :p1='22057713', :p2='R', :p3='1', :p4='47311'] > > at /home/oraweb/perl/frs/ kfsupdate.pl line 64, <DATA> line 581. > > > > I'm pretty sure I count 4 placeholders and 4 parameter values in > > that error message, so where is the '3 bind variables' coming from? > > > > here's the cursor definition: > > > > my $csr_emp_info = $lda->prepare("insert into > > employee_fte_annualrate_l (emplid, emptype_cd, fte, annual_rate) > > values(?,?,?,?)"); > > > > I'm pulling the data from an LDAP query, here's the offending line > > 64 (where $mesg is the returned LDAP object): > > > > $csr_emp_info->execute($mesg->entry($n)->get_value('emplId'), > > $mesg->entry($n)->get_value('employeeType'),$mesg->entry($n)->get_value('employeeFTE'),$mesg->entry($n)->get_value('employeeTotalAnnualRate')); > > > > All the columns allow null entries, and these are all single-valued > > entries in the LDAP schema. > > > > > > -- > > Bruce Johnson > > University of Arizona > > College of Pharmacy > > Information Technology Group > > > > Institutions do not have opinions, merely customs > > > > > > > > -- C. Chad Wallace, B.Sc. The Lodging Company http://www.lodgingcompany.com/ OpenPGP Public Key ID: 0x262208A0
