Re: Ctrl C in SQLPlus exits Windows

  • From: "Yong Huang" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "yong321" for DMARC)
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 8 Apr 2019 16:49:04 +0000 (UTC)

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

As Andy pointed out, beginning with Oracle 18.2, pressing CTRL+C aborts a 
long-running SQL and returns the cursor to the SQL> prompt, or is equivalent to 
pressing Enter if the session is idle.

Apparently, this version of sqlplus.exe has added CTRL+C handling by calling 
the function SetConsoleCtrlHandler, probably in response to enhancement request 
8890996. You can find the string in this version of the executable:

C:\Temp>strings -q 
C:\app\client\username\product\18.0.0\client_1\bin\sqlplus.exe | findstr 
SetConsoleCtrlHandler
SetConsoleCtrlHandler

Interestingly, CTRL+BREAK during normal run of sqlplus seems to be left as 
default. So, pressing that key combination will still abort.

If you're used to pressing CTRL+C to abort and exit Sqlplus, now you type exit 
or quit, or undocumentedly, CTRL+Z and Enter or CTRL+Z alone. (But if you have 
an uncommitted transaction, CTRL+Z will commit.) A minor annoyance is that if 
you type the connect identifier wrong as in "sqlplus user/pass@nosuchdb", you 
either wait about 20 seconds for the network timeout or use Task Manager or 
some kill program to kill it. Neither CTRL+C nor CTRL+BREAK works.

Yong Huang
--
//www.freelists.org/webpage/oracle-l


Other related posts: