exit status for isql

I'm trying to write a script that will update a table in sysbase.
If it's failed then I want to rerun it one more time before exiting the script (fail due to bad value such as trying to put a string into datetime field or bad connection to the database)

Well my code below will always return exit 0 if the connection to the database is good.
How can I check to see if the update statement (SQL) is successful or not successful so I can rerun it again (loop it back).

Please advice.

Here is part of my code.

#!/bin/ksh

display_msg "\nSet start time to today date and till date to the end of previous month - logs into $LOGFILE"
connection_str="-S $SYBASE_SERVER -U $SYBASE_USERNAME -D $DATABASE"
isql $connection_str <<-ISQL_END | egrep -v "Password:" >> $LOGFILE 2>&1
$SYBASE_PASSWORD

    update rls_job set start_time = '$logtime', till_date = '1'

go
ISQL_END
ret=$?

display_msg "Complete reset start time and till date - Return code = $ret"
let totalret=$totalret+$ret

echo `date +"%d.%m.%Y %H:%M:%S"`" End of script $0 with combined code = $totalret - logs in $LOGFILE" | tee -a $LOGFILE

if [ `grep "Msg" $LOGFILE | wc -l` -gt 0 ]; then
display_msg "Warning: Error detected in $LOGFILE"
exit 255
fi

exit $totalret

isql within shell is always a little tricky.
I'd suggest capturing the output and using grep to look for an 'it worked' message. If it doesn't find one, it can consider the isql command to have failed.

Thsnks I will give it a try