Thanks guys!
I got it to work by using an array and dropping the "\".

Ron,
I should have mentioned that I'm using MySQL, so I don't think SGA will
be an issue.  I will keep your warning in mind though.

Thanks again all.

Steve

-----Original Message-----
From: Jonathan Leffler [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 09, 2006 10:52 PM
To: Berlage, Steve
Cc: dbi-users@perl.org
Subject: Re: Bind variable question

On 11/9/06, Berlage, Steve <[EMAIL PROTECTED]> wrote:
>
>
> Here is what I am trying to do:
>
> $UPDATE_COMPANY_STRING = "ccompStreet = ?";
>
> $UPDATE_COMPANY_VALUE_STRING = "\$tmpccompStreet";
>
>
>
> $sql="UPDATE clientcomp SET $UPDATE_COMPANY_STRING WHERE ccompid = ?";
>
> $sthUpdate = $dbh->prepare($sql);
>
> $sthUpdate->execute($UPDATE_COMPANY_VALUE_STRING, $tmpstcompid);
>
>
>
> Obviously there are many more fields that _may_ be added to the 2
> variables that are in all caps (I only showed 1 for simplicity).  I
only
> add the fields that need to be updated to those 2 variables.  It does
> what I expect it to do except for the last line.  I want the
> $UPDATE_COMPANY_VALUE_STRING to be expanded to the actual string it
> contains before the "execute" is run.  I've tried a bunch of different
> ways to make it happen - all to no avail.  I either get errors or end
up
> with "$tmpccompStreet" in the database (instead of the value that
> $tmpccompStreet contains).
>
> Hopefully it's clear what I'm trying to accomplish here.  Please be
kind
> - I'm relatively new to pl/sql :)



I think you have the wrong data structure for the value string - what
you
need is an array of values, with the ccompid value at the end and the
other
values in sequence.  So, build the SQL statement one item at a time and
add
the corresponding value to an array.

You then pass the array to the $sth->execute() call.

--
Jonathan Leffler <[EMAIL PROTECTED]>  #include <disclaimer.h>
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."


Confidentiality Notice: The material in this e-mail is intended only for the 
use of the individual to whom it is addressed and may contain information that 
is confidential, privileged, and exempt from disclosure under applicable law. 
If you are not the intended recipient, be advised that the unauthorized use, 
disclosure, copying, distribution, or the taking of any action in reliance on 
this information is strictly prohibited. If you have received this e-mail in 
error, please immediately notify us at 866-335-3289 to arrange for the return 
of this material to us. Thank You.

Reply via email to