my $sql =<<'EOFSQL'; SELECT LOWER(field_one), field_two, UPPER(field_three) FROM sample_table (NOLOCK) WHERE field_one = ? EOFSQL my $sth = $dbh->prepare($sql) or die; my ($field_one, $field_two, $field_three); for my $test_value (@test_values) { $sth->bind_param(1, $test_value); $sth->execute; $sth->bind_columns(\$field_one, \$field_two, \$field_three); while ($sth->fetch) { print join "-", ($field_one, $field_two, $field_three); } }