in reply to bind not working with DBI?

EUREKA!!!

The problem was (sort of) in the query. The account_id field is a CHAR(48) field and apparently DBI tries to match against all 48 characters rather than just what's in the field. So, even though the query worked in SQLPlus as written, I had to change a line in the criteria to "where trim(account_id) = ?" for it to work in the Perl program.

Darn! I wish I could vote myself up.
GM

Replies are listed 'Best First'.
Re: Re: bind not working with DBI?
by GhodMode (Pilgrim) on Jul 30, 2003 at 18:07 UTC
    EVEN BETTER!!

    My last message was a solution, but not the best one...

    When I tried to set the data type for the bind_param method, I used 12, which is VARCHAR2, but I should have checked more carefully. The data type in the database is CHAR (type #1). I suspected the data type from the start, but I didn't know how to set the data type properly at first. I thought the data type was VARCHAR2 anyway, which the documentation says is the default.

    Instead of using the trim SQL function, it works if I set the data type in the bind_param method to 1, i.e.:
    $sth->bind_param( 1, $_, 1 )
    :)

    GM