Passing variable from file to Oracle

cat a1 
scott
robert
tom
test

script :

#!/usr/bin/ksh
  
for NAME in `cat a1`
do
VALUE=`sqlplus -silent "nobody/bobody01@testq" <<END
set pagesize 0 feedback off verify off heading off echo off
select username from dba_users where username=upper('$NAME');
END`
if [ -z "$VALUE" ]; then
    echo "USER DOES NOT EXISTS: $NAME"
    exit 0
else
    echo "USER EXISTS: $NAME"
fi
done

output coming only first 2 variables

USER EXISTS : scott
USER DOES NOT EXSITS : robert

can Somebody tell me why it is not reading all values from file

That is because of the

exit 0 

statement. Try leaving that out..

Because you put an exit 0... and so after Robert it exists...

it worked , thanks