How to check sqlplus command is successfull or not in HP UX?

Hi All,

I am not able to check the output of sqlplus command if it fails.

can any body please help me in this regard.

Can you show us the code you are trying to execute and better explain your circumstances ??

sqlplus -s rcrp/rcrp<<EOF
update PRICE_CLASS_DET set PCD_VALUE=1 where PCD_ID=11313;
commit;
exit;
EOF

    if [ $? != 0 ]
    then
            echo "The Tariff Group Revert Back to Residential Type Customer for Antillia is not completed." | mailx -s "A

NTILLIA BOC ERROR $0" $MAILTO
exit;
fi

The above if condition is not able to catch the error from sqlplus command.

Suggestion is somthing like the following:

. ${HOME}/.profile
......
sqlplus $ASQLUSER @$SQL_DEPOT/sqlplus_filename.sql
......
if [ Check-ERROR-Condition-of-SQL-Output-File ]
then
echo "The Tariff Group Revert Back to Residential Type Customer for Antillia is not completed." | mailx -s "A
NTILLIA BOC ERROR $0" $MAILTO
exit;
fi

= = = = = = = = = = = = = = = = = = = = = =
In . ${HOME}/.profile

$ASQLUSER=rcrp/rcrp

= = = = = = = = = = = = = = = = = = = = = =
In $SQL_DEPOT/sqlplus_filename.sql

spool $SQL_DEPOT/LOGS/sqlplus_filename.log
update PRICE_CLASS_DET set PCD_VALUE=1 where PCD_ID=11313;
commit;

= = = = = = = = = = = = = = = = = = = = = =

Hope that the above is able to assist you.
Also makes managing your sql and unix scripts a little easier too.

Cheers,
Cameron.

Cameron,

That's Brilliant !!!!!!!!

Thanks a lot.

Cheers,
Plaban

No problem - glad I was able to help.