Strange one here to pass by everyone:

Oracle 8.0.5.1.1 server
Perl 5.00503 (on both alpha-dec_osf and Solaris)
DBI 1.14

Take an Oracle table FOO, with a single field BAR which is a CHAR(8).
Most everything in that field BAR is 8-characters long, but there are a
couple that are 5 characters long.

In SQLPLUS, I can do:

SQL> SELECT COUNT(*) FROM FOO WHERE BAR = '12345';
or
SQL> SELECT COUNT(*) FROM FOO WHERE BAR = '12345   ';

Both work, and give the correct value.

However, from Perl/DBI:

$sql = "SELECT COUNT(*) FROM FOO WHERE BAR = ?";
$sth = $dbh->prepare($sql);
$value = '12345';
$sth->execute($value);
($result) = $sth->fetchrow_array();

The $result is always zero, which is incorrect.  Stays like that even if I
change

$value = '12345';
to
$value = '12345   ';

What am I missing?

-Rick

+--------------------------------------------------------------------------+
|                 Rick Osterberg   [EMAIL PROTECTED]                |
|         Database Applications Specialist     FAS Computer Services       |
+--------------------------------------------------------------------------+

Reply via email to