Error handling in Unix shell scripting

Hello,

I have written a shell script and suppose there is any error in the script. How i can do exception handling in shell script.for example i have below code

sqlplus -s <<uid>>/<<pwd>>@<<$ORACLE_SID>> <<EOF > 1_pid1.log
set pagesize 0
set feedback off
set heading off
set linesize 200
@ pid_file.sql
exit
EOD

when i run above code it should create log file with 1_pid1.log
but it was not working becuase at the last line i did spelling mistake and writtern "EOD" instead off "EOF".

So i just want to know, how can i do error handling in unix shell script.

Thanks in Advance,

its a 'script', parsed line by line.
you wont find error until line is parsed or EOF is reached searching for expected line