Trap Oracle error in shell script

 
sqlplus -s usrname/password@dbSID <<-SQL >> logfile
@create_table.sql
commit;
quit;
SQL

I am running this script to execute an sql file.
I want to display the oracle error if anything found during execution of the sql file and exit from script.

Please suggest How do it.

u can make use of WHENEVER SQLERROR feature of Oracle in your .sql to return the oracle error code and pass it to oerr ora <<error number>> to display the error description.