Testing a comand in the script

Hi everyone , i am new to shell scripting and am having some problem to test if this line has been executed well and display a pass message on the screen or fail if not
sqlplus XXTEST/$2 <<END > $XXTEST_TOP/log/$0.log
@$XXTEST_TOP/admin/sql/XXTEST_SPE1_XX_QUOTE_DETAILS_TBL.sql XXTEST$2 XXTEST_DATA XXTEST_IDX APPS $1
END

Can anyone help me please its really important.... Thank you in advance
Lutchumaya

Possible sol 1
if you set the $? to a variable after at the END then it may provide you with the result 0=pass or >0 fail. However I think the result may be from the sql block not the sql script.

Possible sol2
The other option is to do the Pass or Fail test in your sql script and echo a PASS or FAIL. This way you could run your sql block thus.

end_sql=`sql <<END line1;line2;END`

echo $end_sql

I don't play with sql at all any more but you could try either one of these and see what works. Just be careful that if you use $? in possible solution 1 you may get the result of the END statement.

You will need to test and be sure.

If this don't work then may be it may spark an idea in some one else in the forum..

Thanks for your help Andrek but i didnt understand can u be more explicit thanks for your attention.... I am really new to shell programming here just been looking at it for a week here...
Thank you again