Re: SQL*PLUS interrupt question

From: Ian Parkin <iparkin_at_lssec.bt.co.uk>
Date: 04 Jan 94 17:44:42 GMT
Message-ID: <1994Jan4.174441.22631_at_lssec.bt.co.uk>


In article 1wF_at_ncrcae.ColumbiaSC.NCR.COM, sanju_at_churchill.ColumbiaSC.NCR.COM (Sanjeev.Agrawal) writes:
>
>Wish you all a very happy and eventful new year.

Happy Easter.

>I am running an sqlplus script from command line in silence mode.
>If user interrupts the operatin the control remains in sqlplus
>and it does not come back to operating system.

This is all to do with the way in which SQLPlus handles interrupts. I care not for the way it does this so I rely on my trusty Bourne shell ( no home should be without one ).

I assume you are on a eunuch box of some description - ya didn't say ya weren't

Consider the following two scripts ( set ${user_pass} to valid value and use a valid update statement for your db ) :-

--CUT--

#!/bin/sh
# 
# I guess you are doing summat like this
#

# Trap interrupts and print a message
#
trap 'echo HELL;rm ${tmp}' 1 2 3 4 5 6 7 8 10 12 13 14 15 user_pass=""
tmp=./$$.sql

cat << ! >> ${tmp}
update equipments set eqpt_id = eqpt_id; exit
!

# Here you are left in sqlplus :-(
#
echo SQLPLUSING
sqlplus -s ${user_pass} _at_${tmp}
rm ${tmp}
--CUT-- --CUT--

#!/bin/sh
#
# Try summat like this
#

# Trap interrupts and print a message
#
trap 'echo HELL' 1 2 3 4 5 6 7 8 10 12 13 14 15 user_pass=""

# Here you should exit sqlplus :-)
#
echo SQLPLUSING
sqlplus -s ${user_pass} << !
update equipments set eqpt_id = eqpt_id; exit
!
--CUT-- If this works for you and you have an enquiring mind (tm) read up on `<<` and `trap` for the /bin/sh ( man sh ).

The /bin/csh has equivalent `<<` and `onintr` but I'm a 'sh-man' (tm) but I don't think they are as flexible - but they may be man enough for the above type of thing.

>Any pointers will be highly appreciated.

FILE *fptr = (FILE*)NULL;

IAP Received on Tue Jan 04 1994 - 18:44:42 CET

Original text of this message