List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:August 28 1999 4:46pm
Subject:Re: selecting NULL values
View as plain text  
Clifford Meece wrote:
> 
> I have a script that calls:
> 
> $sth=$dbh->prepare(qq{select acctId from accounts where
> acctNum='$acctNum' and subAcct=NULL});
> 
> This command works fine from the msql command propt(with $acctNum
> replaced with an actual value) but fails from my perl script with the
> error:
> 
> DBD::mSQL::st execute failed: parse error at line 2 near "= *end of
> input*" at ./findacct.new line 70.

What's $acctNum? Is it possible that it includes NUL bytes, single
quotes or something else?

If it doesn't include NUL bytes, you should never use '$acctNum', but
$dbh->quote($acctNum).

If it includes NUL bytes, forget about mSQL: It cannot deal with that.


Bye,

Jochen


-- 
Jochen Wiedmann						joe@stripped
Life has brown and green eyes. :-)			+49 7123 14887


Thread
selecting NULL valuesClifford Meece28 Aug
  • Re: selecting NULL valuesJochen Wiedmann28 Aug
  • Re: selecting NULL valuesJochen Wiedmann29 Aug
Re: selecting NULL valuesStork29 Aug
  • Re: selecting NULL valuesJochen Wiedmann29 Aug
  • Re: selecting NULL valuesJochen Wiedmann29 Aug