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 -> Whenever SQLERROR - does it work?

Whenever SQLERROR - does it work?

From: Kirt Thomas <kremovethisspamthingthomas_at_gfsiinc.com>
Date: Mon, 21 Jan 2002 09:46:04 -0600
Message-ID: <p7do4u4h9emg16cjh8t1jsbsleo2ul567a@4ax.com>


I have a shell script that checks for a given process, and if it's running does some stuff - here's a bare outline

#!/bin/ksh

sqlvalue="`sqlplus -s<<EOF
sys/$SYS_PASS
set heading off
set feedback off
set verify off
set echo off
select count(sid)
from v\\$session vs
where vs.program like 'OEOSCO';
exit
EOF`"
echo "Sqlvalue=$sqlvalue"

This all works just fine, and I get a count of the number of processes, and can do more stuff based on this (it ends up paging someone). The problem I have is that during our weekly db maintenance, this script (which is crontab'd to run every 10 minutes) returns tons of verbiage to the sqlvalue because the db is down.

So I figured I'd just add a line

whenever sqlerror exit 0;

to force an exit with a value of zero on any sqlerror. Since it would not be good for my continuted employment to test this by bringing the db down, I just dropped the 'n' from v$session - to force an sql error. Instead of echoing '0' as expected I get the following ....

Sqlvalue=from v$sessio vs

       *
ERROR at line 2:
ORA-00942: table or view does not exist

Soooo, what gives? That is definately an sql error. Am I doing something wrong, or does whenever sqlerror not really work as I think it should. Thanks. Received on Mon Jan 21 2002 - 09:46:04 CST

Original text of this message

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