Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Exiting a Shell Script based on results of SELECT
>I have a shell script which runs overnight which calls several other
scripts.
>In between, I want to check # of records from a table
In count.sql:
set heading off
set feedback off
select count(*)
from my_table;
exit
In your Unix shell script (no errorhandling, like Oracle not being available...):
result = $( sqlplus -silent scott/tiger @count.sql )
echo "${result} row(s)"
# exit if result less than 10:
if test ${result} -lt 10
then
echo "Too few rows" exit 1
Arjan. Received on Thu Aug 27 1998 - 14:45:05 CDT