Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Sqlplus and Unix : getting a non zero return code

Re: Sqlplus and Unix : getting a non zero return code

From: Nuno Souto <nsouto_at_optushome.com.au.nospam>
Date: Tue, 21 Aug 2001 09:40:09 GMT
Message-ID: <3b822a27.1627709@news>


On 20 Aug 2001 21:23:14 -0700, stemp1ar_at_yahoo.com (Simon) wrote:
>Any help would be great...TIA
>
>check_error() {
> if [[ -a errfile ]]; then
> err_count=$(grep -c -e ^[^$] errfile)
> else
> err_count=0
> fi
> if (( err_count > 0 )); then
> echo "\nErrors have been encountered. Please refer to
>errfile"
> fi
>}
> sqlplus -s > test.out 1>errfile 2>logfile <<EOF
> username/pass
> whenever sqlerror exit failure
> set serveroutput on
> spool outfile
> select count(*) from table_name;
> spool off;

Delete this line? -----> exit;
> EOF
>
> RC=$?
> if [[ $RC = 0 ]]; then
> echo "Inside zero rc=$RC"
> else
> echo "Inside non-zero RC=$RC"
> exit -1
> fi
>
> check_error

Cheers
Nuno Souto
nsouto_at_optushome.com.au.nospam Received on Tue Aug 21 2001 - 04:40:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US