$? is the return status of the last command. In your example, EXIT_CODE will always be 0, unless the echo command fails, which is never going to happen.
echo $RETVAL EXIT_CODE=$? if [ $EXIT_CODE = 0 ]
The $RETVAL variable simply contains the output or string returned by your sqlplus command. What you need to do is to check for content of the $RETVAL variable. What content is considered successful and what failure?
RETVAL=`sqlplus -s apps/apps@VIS <<EOF >>$LOG
exit; EOF ` echo "$RETVAL" >> $LOG if [ `echo "$RETVAL" | grep FAILED` ]; then ....