Hi,
I tried to run this code but it isnt giving me any output or errors.
My aim is to retrieve the row based on the flag name(this is the primary key).
flag_test is my table
This is how i ran it:
perl read_db.pl flag1
flag1 is the criteria in where clause
--------
this is my code:
#!/usr/bin/perl
use DBI;
sub read_db
{
$dbh = DBI -> connect('DBI:Oracle:mercury','student','learn') || die "unable to connect:$DBI::errstr";
my $dbh = DBI->connect();
my $sql = qq/select flag_name, f_name, l_name from flag_test where flag_name =?/;
my $sth = $dbh->prepare($sql);
$sth->execute();
my ($col1, $col2, $col3);
$sth->bind_col(1, \$col1);
$sth->bind_col(2, \$col2);
$sth->bind_col(3, \$col3);
while ($sth->fetch) {
print "$col1, $col2, $col3\n";
}
}
could somebody help me with this?
thanks,
mercury