This is a quickie version of what I'm doing:

$sql ="insert into foo (bar, baz, buz) values(?,?,?)";
$csr = $dbh->prepare($sql);
while (ldap query runs){
        @parms =($val1,$val2,$val3);
        if ($val1 eq 'A'){ $csr->execute(@parms);}
        }

The thing is, this is the second query to the LDAP server in the program, the 
first one, using identical DBI code, works.

The only difference is the LDAP query.

On Feb 18, 2011, at 1:10 PM, Furst, Carl wrote:

> Are you calling $csr->finish at the end of each iteration? Might not be the
> issue but indeed good practice.
> 
> Carl Furst
> o/~ What a difference a byte makes... o/~
> 
> -----Original Message-----
> From: Bruce Johnson [mailto:john...@pharmacy.arizona.edu] 
> Sent: Friday, February 18, 2011 3:07 PM
> Cc: DBI Users List (dbi-users@perl.org)
> Subject: Re: One of us can't count....
> 
> No, this is done as:
> 
> $csr=$dbh->prepare($sql)
> 
> then as $csr->execute(@parms) inside of a loop.
> 
> On Feb 18, 2011, at 12:33 PM, Bill Ward wrote:
> 
>> You're probably calling do($sql, @args) when you should call do($sql,
> undef,
>> @args)
>> 
>> On Fri, Feb 18, 2011 at 11:31 AM, Bruce Johnson <
>> john...@pharmacy.arizona.edu> wrote:
>> 
>>> I'm getting the following error: (some data has been change to protect
> the
>>> bystanders.)
>>> 
>>> DBD::Oracle::st execute failed: called with 18 bind variables when 19 are
>>> needed [for Statement "insert into edsbase
>>> 
> (cn,emplId,employeeType,employeeTitle,employeeStatus,employeeTotalAnnualRate
> ,sn,givenName,netid,mail,employeeBldgName,employeeBldgNum,employeeCity,emplo
> yeeFTE,employeePhone,employeePoBox,employeeRoomNum,employeeState,employeeZip
> )
>>> values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
>>> " with ParamValues: :p1='Werner S Noname', :p10='some@here', :p11='COLL
> OF
>>> PHARMAC', :p12='00207', :p13='TUCSON', :p14='0', :p15='5205114411',
> :p16='PO
>>> BOX 210207', :p17='344', :p18='AZ', :p19='85721-0207', :p2='111111111',
>>> :p3='N', :p4='nosal', :p5='A', :p6='0', :p7='Zimmt', :p8='Werner S',
>>> :p9='wsz'] at ./edsload.pl line 97, <DATA> line 532.
>>> 
>>> I've counted three times: I have 19 fields in the db, 19 '?'s, and 19
> param
>>> values being passed, why am I getting this error?
>>> 
>>> 
>>> 
>>> --
>>> Bruce Johnson
>>> University of Arizona
>>> College of Pharmacy
>>> Information Technology Group
>>> 
>>> Institutions do not have opinions, merely customs
>>> 
>>> 
>>> 
>> 
>> 
>> -- 
>> Check out my LEGO blog at http://www.brickpile.com/
>> View my photos at http://flickr.com/photos/billward/
>> Follow me at http://twitter.com/williamward
> 
> -- 
> Bruce Johnson
> University of Arizona
> College of Pharmacy
> Information Technology Group
> 
> Institutions do not have opinions, merely customs
> 
> 
> 
> 
> 
> 
> 
> **********************************************************
> 
> MLB.com: Where Baseball is Always On

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs


Reply via email to