RE: Bind variable question



Reidy, Ron [mailto:Ron.Reidy@xxxxxxxxxxxxxxxxxx] wrote:

Your statement only has one bind variable (?). The other "bind
variable" is actually a Perl variable. Your execute will fail because
of this.

However, there is another issue. You cannot substitute bind variables
in this manner. Your attempt to dynamically build column names will
fail. You will need to use 'EXECUTE IMMEDIATE' to perform this type of
action.

I think you're misinterpreting his code. He's just building up an SQL
statement in steps. After all the assignments, the value of $sql that's
passed to $dbh->prepare() is:

UPDATE clientcomp SET ccompStreet = ? WHERE ccompid = ?

which is perfectly valid. The only problem I see is that he's passing the
wrong value for the first bind parameter.

Ronald


.



Relevant Pages

  • Re: Clarification on DBI module
    ... You get the same results for the second execute because the record buffer in the statment handle is not cleaned out because no execute took place. ... The sql query can have bind variables or they may not have. ... Ahhh...imagining that irresistible "new car" smell? ...
    (perl.dbi.users)
  • RE: Bind variable question
    ... Your execute will fail because ... You cannot substitute bind variables ... intended recipient, please be aware that any disclosure, copying, distribution ...
    (perl.dbi.users)
  • Re: Clarification on DBI module
    ... You get the same results for the second execute because the record buffer ... The sql query can have bind variables or they may not ... > Ahhh...imagining that irresistible "new car" smell? ...
    (perl.dbi.users)
  • RE: why "cant execute " error ?
    ... Your calling your execute with a variable of some kind but your sql has no ... called with 1 bind variables when 0 are needed ... Any opinion expressed in this e-mail is personal to the sender ...
    (perl.beginners)
  • RE: SQL Parsing question
    ... DDL and bind variables don't mix. ... is not detected properly by the program, the EXECUTE can fail with the ORA-01036 ... Executing alter user:DBUser identified by blarg ...
    (perl.dbi.users)