Unix + oracle connection

Requirements:

Using a shell script I have to check the 4 values from a table in Oracle and then store the result as "Y" in a Unix variable if the values are desired and "N" if the values are not desired.

Explanation:

There is a table abc in oracle which has 4 fields. if all the four values comes out to be 1 then i want to assign a Unix variable "result" as "Y".

If even one of the values is "0" then i want to assign the UNIX variable "result" as "N".

All this has to be done using UNIX shell scripting.

Request the experts to come ahead and help me.

Decci

One way -

sqlplus -s username/passwd@oracledb<<EOF
set head off
set feedback off
spool tmp.tmp
select fld1 + fld2 + fld3 + fld4 from abc;
spool off
exit
EOF
result=0
grep -q '4' tmp.tmp
if [[ $? -eq 0 ]] ; then
  result=1
fi

jim, would it not print wrong if the values were 4,0,0,0 ?