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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Run command on sqlplus repetitively without reconnection

Re: Run command on sqlplus repetitively without reconnection

From: Senthil Subramanian <skumar.sen_at_gmail.com>
Date: Mon, 21 May 2007 22:29:04 -0400
Message-ID: <262c4b400705211929l5cfa8b21p9c8147703f978a54@mail.gmail.com>


David,

You should try with 'print -p exit' instead of 'print -f exit' inside the trap. The 'print -p exit' command will send the SQL*Plus command EXIT to the co-process when you press Ctrl-C. In this way, you could gracefully exit from SQL*Plus instead of killing your session.

Thanks,

Senthil.

On 5/21/07, David Taft <oradbt054_at_gmail.com> wrote:
>
> Senthil,
>
> Unfortunately the sqlplus session was still running in the background when
> I tried the 'print -f exit' inside the trap. However, that got
> me rethinking the problem. What worked was the the following:
>
> trap 'kill %2;kill %1;exit' 1 2 3 15
>
> I realized that I had two background jobs running, the sqlplus session and
> the first while loop containing the SQL. So the trick was to kill the first
> while loop (%2), then the sqlplus (%1) and finally exit the second while
> loop. No errors now when I Ctl-C and no background processes left running.
>
> Thanks for your feedback, it did help.
>
> David
>
>
> On 5/18/07, Senthil Subramanian <skumar.sen_at_gmail.com> wrote:
> >
> > You could try 'print -p exit; exit;' in the trap command to exit
> > gracefully from both SQL*Plus and the shell.
> >
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon May 21 2007 - 21:29:04 CDT

Original text of this message

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