tags:

views:

70

answers:

2

I am doing the below in a perl script:

my @pm1_CS_missing_months = `sqlplus -s $connstr \@DLmissing_months.sql`;

it takes the output of an sql query. if i have to check for no rows selected,how could i do it? i want to do like this:

if(no rows selected)
{
do this;
}
+1  A: 

I'd go with DBD::Oracle.

René Nyffenegger
Indeed, if you need more than the raw output of the command, the exec quotes are not enough, I'd go for DBI/DBD too.
PW
And not only for checking the raw output of the command, but also to check whether the connection to the server was successful.
René Nyffenegger
+3  A: 

In scalar context (for example, in an if or unless condition), an array evaluates to the number of items in the array. If your SQL result set contains no rows, the array will evaluate to 0 -- one flavor of falseness.

unless (@pm1_CS_missing_months){
   # No rows: do this...
}
FM