I'm using DBI version 1.13 on an Oracle 8.1.7 database with Perl version 5.004_02 and I can't get placeholders and bind values to work. There are no error messages, it just doesn't return any rows.
The field in the criteria is a VARCHAR2 data type.
This works...
...
... but this doesn't ...my @accounts = qw{ 118554 118555 118528 118529 118523 }; for ( @accounts ) { my $statement = " select distinct account, account_id, company, the_date from account_information where account_id = '$_' "; my $sth = $dbh->prepare( $statement ); $sth->execute; while ( my @row = $sth->fetchrow_array ) { print join( "\t", @row ) . "\n"; } }
I have tried setting $sth->bind_param( 1, $_ ) separately, but I didn't have any luck.my $statement = " select distinct account, account_id, company, the_date from account_information where account_id = ? "; my $sth = $dbh->prepare( $statement ); my @accounts = qw{ 118554 118555 118528 118529 118523 }; for ( @accounts ) { $sth->execute( $_ ); while ( my @row = $sth->fetchrow_array ) { print join( "\t", @row ) . "\n"; } }
In reply to bind not working with DBI? by GhodMode
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |