COUNT(1) TO A UNIX VARIABLE ...

COUNT(1) TO A UNIX VARIABLE ...

 

  

Hi all,

Am looking for a script that returns the value of count(1) and found this
solution on the web ...

#!/bin/sh
VALUE=`sqlplus -silent user/[Email Address Removed] <<END
set pagesize 0 feedback off verify off heading off echo off
select max(c1) from t1;
exit;
END`
if [ -z "$VALUE" ]; then
echo "No rows returned from database"
exit 0
else
echo $VALUE
fi

Does anyone have a more simpler solution than this one? Thanks ...




Oracle LazyDBA home page