D
dn.perl
I have a table t1: State, Capital.
Entries are ('CA', 'Sacramento'), ('MA', 'Boston') and ('TX',
'Austin').
Here is a block which returns nothing :
my $my_list = " 'CA', 'MA' " ;
my $sth = $dbh->prepare("select capital from t1 where state in (?)");
$sth->execute($my_list) ;
If I replace it with the following, I get the expected results:
my $my_list = " 'CA', 'MA' " ;
my $sth = $dbh->prepare("select capital from t1 where state in
($my_list)");
$sth->execute() ;
What could be the problem?
Thanks in advance.
Entries are ('CA', 'Sacramento'), ('MA', 'Boston') and ('TX',
'Austin').
Here is a block which returns nothing :
my $my_list = " 'CA', 'MA' " ;
my $sth = $dbh->prepare("select capital from t1 where state in (?)");
$sth->execute($my_list) ;
If I replace it with the following, I get the expected results:
my $my_list = " 'CA', 'MA' " ;
my $sth = $dbh->prepare("select capital from t1 where state in
($my_list)");
$sth->execute() ;
What could be the problem?
Thanks in advance.