use DBI; my $dbh; use DBI qw(:sql_types); $dbh = DBI->connec('Dbname','usrname','passwd','Oracle', \%attr); my $sth_LOG = $dbh->prepare( qq{select num_org_mfg,cd_typ_evnt_dntm,num_rsn_dntm from mfg_evnt.dntm_rsn_ulog where num_org_mfg = 7664 and cd_typ_evnt_dntm ='DNTM' and num_rsn_dntm = 2}); my $sth_DNTM = $dbh->prepare(qq{select num_org_mfg,nam_rsn_dntm from mfg_evnt.dntm_rsn and cd_typ_evnt_dntm= ? and num_org_mfg = ? }); if($DBI::errstr) { print "error in preparation ........\n"; } $sth_LOG->execute(); if ($DBI::errstr) { print "error in sth_log execute\n"; } ($num_org, $cd_typ, $num_rsn) = $sth_LOG->fetchrow_array(); # binding parameters to sth_DNTM statememt $sth_DNTM->bind_param(1,$cd_typ); $sth_DNTM->bind_param(2,$num_org); $sth_DNTM->execute(); @row = $sth->fetchrow_array(); print "@row\n"; $sth_LOG->finish; $sth_DNTM->finish; $dbh->disconnect;