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"; }