Capacio, Paula J wrote:
John wrote:
Can anyone see the error in the following code. It has to do with the
placeholder in the select statement. Substitution fails to occur at
the "$sth1->execute..." statement script dies at "while (my
$rowref...". If I replace the placeholder with a literal it works as
expected.
[code] snipped
I'm not sure if this is relevant because of differences in the database
type, but here goes...
We had a similar problem with an Oracle database, and from an item
on this list I found the following which fixed our issue.
"CHAR column values are padded with spaces to the length of the column.
When compared with a literal, the SQL engine automatically
adds the padding to the literal. When compared with a placeholder, the
blank padded semantics are not available unless the placeholder type is
CHAR."
Evidently this is not unique to the Perl DBI, it was documented in the
Oracle OCI manual. Is it possible that SQLite is similar?
If so you may need something similar to this:
use DBD::Oracle qw(:ora_types);
... # after connect but before prepare
$dbh->{ora_ph_type} = ORA_CHAR;
FWIW, Hope it helps.
Paula
Thanks Paula
I don't think that is the issue, in fact I don't think it is a DBI/SQL
issue at all because when I do this:
[code]
{
#$custnum = shift @duplist;
#redo if int($custnum) == 0;
$custnum = "000281610"; <===#######
$sth1->execute( $custnum ) or die "couldn't execute... " . DBI->errstr;
while (my $rowref = $sth1->fetchrow_arrayref) {
($asset, $custnum, $branch, $customer, $address, $town,
$postcode) = @$rowref;
[/code]
it works.
I will look into how I load @duplist and if I have further problems I
will take them elsewhere.
--
Regards
John McMahon ([EMAIL PROTECTED])
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.13/198 - Release Date: 12/12/2005