Updated 5 January, 2023
In this post, I’m going to show you how to:
- ‘cancel’ yourself out of a buffer/command
- cancel a query
- ctrl+c yourself back to the shell/cmd prompt
Starting over on your query/script
Ctrl+C will kill you out of SQLcl completely if you’re in the editor. This is a bug on one of the components we’re using (JLINE), and we have a fix scheduled for SQLcl 19.2. But in the meantime, using the ESC key will provide you all the relief necessary.
You start typing, and at some point, you realize, there’s no fixing this, let’s just start over.
Again, we hope to have this working with Ctrl+C in version 19.2 of SQLcl.
Update: New Escape Sequence as of Version 21.2
Ctrl + G will get you out of the editor/buffer.
You can see this if you run ‘show keymap’ –
Cancelling a query
You’ve successfully submitted your query or anonymous block to the database. Now we want to cancel it. Ctrl+C will send that request.
Now at that point, it’s up to the jdbc driver and the database to decide how and WHEN to handle that request.
Here’s an example.
I’m tired of waiting just get me out of here already
Just hit ctrl+c, again.
Making this more transparent going forward
We also plan in version 19.2 to print status messages to the window. For example, when you send the query cancel, we’ll register that and let you know we’re working on it, so you don’t get frustrated and hit the button again.
I’m also told that in 19.2 with the new JLINE toys, we’ll be able to do some wicked-cool vi integration.