Re: Ctrl C in SQLPlus exits Windows

  • From: Mladen Gogala <gogala.mladen@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Sun, 10 Mar 2019 19:42:59 -0400

Actually, he should switch to SQL*Developer. It doesn't get killed by Ctrl-C. A long time ago, in a galaxy far, far away, there was an OS which had Ctrl-Y in addition to Ctrl-C. I still map Ctrl-Y to SIGQUIT, in order to be able to kill the process if I need. The relevant .bashrc snippet looks like this:

stty erase '^?' intr '^C' susp '^Z' quit '^Y' kill '^X' echoe
unset LS_COLORS
TERM=xterm
tset -r

However, I believe that the Windows version of sqlplus  is not bad, it was just programmed that way. The Linux version does not terminate the program:

SQL*Plus: Release 18.0.0.0.0 - Production on Sun Mar 10 19:35:57 2019
Version 18.3.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Last Successful login time: Fri Mar 08 2019 14:27:56 -04:00

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.5.0.0.0

SQL> select * from emp;

     EMPNO ENAME      JOB           MGR HIREDATE SAL         COMM
---------- ---------- --------- ---------- -------- ---------- ----------
    DEPTNO
----------
      7369 SMITH      CLERK          7902 19801217    800
    20

      7499 ALLEN      SALESMAN          7698 19810220      1600          300
    30

      7521 WARD       SALESMAN          7698 19810222      1250          500
    30

      7566 JONES      MANAGER          7839 19810402   2975
    20

      7654 MARTIN     SALESMAN          7698 19810928      1250         1400
    30

      7698 BLAKE      MANAGER          7839 19810501   2850
    30

      7782 CLARK      MANAGER          7839 19810609   2450
    10

      7788 SCOTT      ANALYST          7566 19870419   3000
    20

      7839 KING       PRESIDENT        19811117 5000
    10

      7844 TURNER     SALESMAN          7698 19810908      1500        0
    30

      7876 ADAMS      CLERK          7788 19870523 1100
    20

      7900 JAMES      CLERK          7698 19811203    950
    30

      7902 FORD       ANALYST          7566 19811203   3000
    20

      7934 MILLER     CLERK          7782 19820123 1300
    10


14 rows selected.

Elapsed: 00:00:00.01
SQL>

SQL>
SQL>
SQL>
mgogala@umajor:~$

However, Jeff Smith has spoiled me rotten. Since approximately a year ago, I am only using this:

mgogala@umajor:~$ sql scott/tiger@ora18c/orclpdb.home.com

SQLcl: Release 18.4 Production on Sun Mar 10 19:38:38 2019

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.5.0.0.0

On 3/10/19 11:41 AM, Mark W. Farnham wrote:


ah. using command prompt sqlplus versus the “gui” sqlplus may be effective. Ram, can you switch to the command line version of sqlplus?

*From:*oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] *On Behalf Of *Chris Taylor
*Sent:* Sunday, March 10, 2019 10:39 AM
*To:* lambu999@xxxxxxxxx
*Cc:* ORACLE-L
*Subject:* Re: Ctrl C in SQLPlus exits Windows

Ram,

Are you executing sqlplus from within another program such as sqldeveloper?  (Like execute SQL as a script)

The only time I've seen control-c exit sqlplus is if SQLplus is executed from another program.

If you call sqlplus from the command prompt, I believe Ctrl-C will interrupt as normal.   You can save your sql scripts as ".sql" files if you're writing them in a guide and execute script as @script or @<path to script>/script.sql .

Chris

On Sun, Mar 10, 2019, 1:59 AM Ram K <lambu999@xxxxxxxxx <mailto:lambu999@xxxxxxxxx>> wrote:

    Installed Oracle in my home Windows PC and playing around with it.
    But pressing Ctrl-C always exits SQL Plus, when I run queries.
    grr... Tried searching online and found  this:

    
https://grokbase.com/t/freelists.org/oracle-l/095myarkwd/11g-sqlplus-on-windows-and-ctrl-c

    Is there a solution for Ctrl C only to interrupt and not to exit
    SQL Plus in windows.

--
    Thanks,
    Ram.

--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217

Other related posts: