#!/opt/perl-5.20/bin/perl use strict; use warnings; use DBI; main(); exit; sub main { my $dbh = DBI->connect or die "oops - $!\n"; my $Customer_ID = 10; my $sql = "select customer_id from t where customer_id = ?"; my $sth = $dbh->prepare($sql) or die "oops - $!\n"; my $rc = $sth->execute($Customer_ID); while (my $rrow = $sth->fetch) { print $rrow->[0], "\n"; } }