my $xpid = 1234; my $procs = $dbh->selectall_arrayref(" select spid from v\$process where spid = $xpid "); if ( @$procs ) { # was one found? print "Pid is in use : $xpid\n"; }