Values in array are not able to be used one by one

hey,i stored the value of an sql query in an array and then tried to use that
value in while loop. actually my array will have two or more values, then according to the values i have to display result.

#!/bin/bash -xv

val_1=$( sqlplus -s rte/rted1@rel75d1 << EOF
set heading off
select max(istat_id) from cvt_istats;
exit
EOF
)
 sqlplus -s rte/rted1@rel75d1 << EOF
++ sqlplus -s rte/rted1@rel75d1
+ val_1='
          999'
echo "val_1: $val_1"
+ echo 'val_1:
          999'
val_1:
          999

nohup ./cvt -f MediationSources.xml &
sleep 60
+ sleep 60
+ nohup ./cvt -f MediationSources.xml
nohup: appending output to `nohup.out'

declare -a arr
+ declare -a arr
arr=$( sqlplus -s rte/rted1@rel75d1 << EOF
set heading off
select source_id from cvt_istats where istat_id > $val_1;
exit
EOF
)
 sqlplus -s rte/rted1@rel75d1 << EOF
++ sqlplus -s rte/rted1@rel75d1
+ arr='
         1
         2'
echo "val_2: $arr"
+ echo 'val_2:
         1
         2'
val_2:
         1
         2

i=0
+ i=0
len=${#arr[*]}
+ len=1
echo $len
+ echo 1
1

while [ $len -gt $i ]
do
  if [ ${arr[$i]} == 1 ]
  then
    echo "%D% FILE MASK PASS"
  elif [ ${arr[$i]} == 2 ]
  then
    echo "%C% FILE MASK PASS"
  else
   echo "FILE MASK FAIL"
  fi

  i=$(( $i + 1 ))
done
+ '[' 1 -gt 0 ']'
+ '[' 1 2 == 1 ']'
./linux8.sh: line 29: [: too many arguments
+ '[' 1 2 == 2 ']'
./linux8.sh: line 32: [: too many arguments
+ echo 'FILE MASK FAIL'
FILE MASK FAIL
+ i=1
+ '[' 1 -gt 1 ']'


but in the array both 1 2 are selected and then it is not able to compare

what should i do

Thanks

---------- Post updated at 01:13 AM ---------- Previous update was at 01:11 AM ----------

my code without xv looks like this

#!/bin/bash -xv

val_1=$( sqlplus -s rte/rted1@rel75d1 << EOF
set heading off
select max(istat_id) from cvt_istats;
exit
EOF
)
echo "val_1: $val_1"

nohup ./cvt -f MediationSources.xml &
sleep 60

declare -a arr
arr=$( sqlplus -s rte/rted1@rel75d1 << EOF
set heading off
select source_id from cvt_istats where istat_id > $val_1;
exit
EOF
)
echo "val_2: $arr"

i=0
len=${#arr[*]}
echo $len

while [ $len -gt $i ]
do
  if [ ${arr[$i]} == 1 ]
  then
    echo "%D% FILE MASK PASS"
  elif [ ${arr[$i]} == 2 ]
  then
    echo "%C% FILE MASK PASS"
  else
   echo "FILE MASK FAIL"
  fi

  i=$(( $i + 1 ))
done

in bash, enclose the values to be assigned in parentheses:

$ arr=(1 2 3)
$ echo ${arr[2]}
3