Tim, can you elaborate a little?  I've tried to find the referenced
documentation but can't.  I don't quite understand how a CHAR datatype
can cause this problem.

Thanks.

Hardy Merrill 

>>> Tim Bunce <[EMAIL PROTECTED]> 11/24/04 07:35AM >>>
On Tue, Nov 23, 2004 at 10:13:30PM +0000, Bart Kelsey wrote:
> I'm having some trouble with DBD::Oracle...
> When I execute this code:
> ***
> 
>    $sth = $dbh->prepare("select * from abbrev where type = ?");
>    $sth->execute("PAYMENT");
>    while((@row) = $sth->fetchrow_array) {
>      print(join(", ", @row), "\n");
>    }
>    $sth->finish;

[Don't call finish at the end of fetch loops. See the docs.]

> ... no rows are returned.  However, when I execute this code here:
> 
>    $sth = $dbh->prepare("select * from abbrev where type =
'PAYMENT'");
> 
> ... it correctly returns a row.  Does anyone know what the problem
might be

I'd guess the "type" column is a CHAR field.

Try:
        use DBD::Oracle qw(:ora_types);
        ...
        $dbh->{ora_ph_type} = ORA_CHAR

before the prepare(). See
http://search.cpan.org/~timb/DBD-Oracle-1.16/Oracle.pm#Database_Handle_Attributes


See also the String Comparison section in the Datatypes chapter of the
Oracle OCI manual for more details.

Tim.

Reply via email to