use strict; use warnings; use DBI; my $dbh = DBI->connect( "DBI:mysql:project") or die "Can't connect to Oracle database: $DBI::errstr\n"; my $sth = $dbh->prepare("SELECT test.id, test1.id FROM test, test1 where test.value=? and test1.value=?"); $sth->execute('friend', 'india') || $sth->errstr(); while (my ($row, $row1) = $sth->fetchrow_array) { print "$row\t$row1\n"; } $dbh->disconnect;