my $xpid = 1234; @procs = $dbh->selectall_arrayref("select spid from v\$process"); if ( grep $xpid, @procs ) { print "Pid is in use : $xpid\n"; }