Exit codes

I am trying to run this SH on Linux and getting error at IF condition.

I want to read the EXIT code and send the failure or success message.

Please help me on this. This worked when i was running on Solaris.

#!/bin/bash
$ORACLE_HOME/bin/sqlplus abc/xyz@qwe @/home/test.sql 
if [ $? -ne 0 ] ; then
    mailx -s "FAILURE" mnk@yahoo.com < /dev/null
    exit 1
else
    mailx -s "$SUCCESS" mnk@yahoo.com < /dev/null

Thanks in advance

Please paste the error you get..

Today I am getting this error when i run the .SH

"P2-0310: unable to open file "/home/test.sql 

but this works when I run the following manually:

$ sqlplus abc/xyz@qwe @/home/test.sql 

Thank you

so there is no issue with if as you said.

and it check whether both invokes the same sqlplus ?
and are you running both from the same login ? and do that kind of debugging to find out.

This got resolved and found the problem during FTP process. "THeGEEK" Thank you for your help.