Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
this works.
my $sth = $dbh->prepare( 'select * from mytable order by col_3' ) or die DBI->errstr; $sth->execute() or die DBI::errstr; while( my $aref = $sth->fetch ) { print "@$aref"; }
this doesn't?
my $sth = $dbh->prepare( 'select * from mytable order by ?' ) or die DBI->errstr; $sth->execute( 'col_3' ) or die DBI::errstr; while( my $aref = $sth->fetch ) { print "@$aref"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI order by clause and placeholders
by pokki (Monk) on Jun 10, 2013 at 18:37 UTC | |
|
Re: DBI order by clause and placeholders
by stephen (Priest) on Jun 10, 2013 at 17:24 UTC | |
|
Re: DBI order by clause and placeholders
by dsheroh (Monsignor) on Jun 11, 2013 at 09:27 UTC | |
|
Re: DBI order by clause and placeholders
by Neighbour (Friar) on Jun 11, 2013 at 06:48 UTC |