Friday, 1 May 2015

SQLcl - Code editing on the console

We've been playing with our console drawing in SQLcl for a while now and this week, we hooked up some keys to make editing and running much easier.  The video will show the following keys for managing your buffer in the console.  This will make it into the next Early Access candidate soon.

  • up arrow - previous history (this will continue to show you the next history unless you move into the text to edit it.
  • down arrow - next history which is the same as above.
If we are editing and not showing history, then the up and down arrow will move up and down the buffer. 
  • ctrl-W will take you to the top left of the buffer and ctrl-S will take you to the bottom of the buffer.
  • left arrow moves right, with ctrl-A taking you to extreme left of that line
  • right arrow moves right and ctrl-E takes you to the extreme right of that line
  • ESC takes you out of edit mode, back to the SQL> prompt
  • ctrl-R will execute your buffer if you are editing it.

Editing SQL in SQLcl

At the start of the video, we paste in a large piece of SQL from Kris' blog and all NBSP get stripped out so you get the full SQL and none of the dross. 

If you are at the end of the buffer and terminate your statement correctly, the next CR will run the contents of your buffer.  If you are anywhere else in the buffer, ctrl-R will run the buffer for you.

Check out the latest one on OTN and come back for these features when we drop the new version of SQLcl on OTN.

2 comments:

Flieger said...

Hi Barry,
thanks for the excellent post. I'm running sqlcl on a MacBook with Yosemite. I'm unable to use the control key combinations because my terminal seems to already has them mapped. For example ctrl-r causes a (reverse-i-search) from bash.
I've tried turning off this key binding with stty stop ^r, but it has no effect in sqlcl.
Have you experienced this?

Thanks,
Christoph

Sridevi Koduru said...

Regards
Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, Oracle Manufacturing, OAF, ADF, SQL, PL/SQL, D2K at sridevikoduru@oracleappstechnical.com | +91 - 9581017828.