Saturday, 5 August 2023

Oracle SQLcl Still Surprises... even when finishing work.

 TL;DR You can use \q in SQLcl. That is Cool! 

As stated before, The Mantra is: 

Everything is SQL, and SQL is everything.

And you should collect sql-scripts and test them, use them...hence you need SQLcl

I Strongly Recommend that you "store" your SQL Knowledge in (runnable) scripts. That way you don't have to go back and google (or AI-chat) to find how a certain query is done, or how to find the size of a set of objects. (on my laptop, typing SQL > @segsize abc% will find all segments by that name and list them with sizes, I've scripted that since the dawn of time to never have to type too much ....)

But that is not Today's little TIL.

So, I tend to have SQLcl installed on my client-machine (and SQLDeveloper, and even artifacts like SQL*Plus and sqlldr, exp, imp). And on my often-used jump-boxes, and bascially everywhere I can. You Need your SQL tools...

And TIL (Today I learned), by accident, this :


For those who now blink: The image above shows that the SQLcl tool will accept the command "\q"  (BackSlash and lowercase Kjuu).

And the \q will tell it to gracefully disconnect and exit.

For some of us, this is Very Convenient, as it is the same command used by a few other (DBA, geeky) tools that we use. I realise I probably have used \q several times on SQLcl without paying attention, as I tend to keep scripts "generic" as much as possible, and have a several versions of "the same script" for various purposes.

Having \q is just ... Convenient! 

And who else knows what is in there. I already found that \d also works.

Hence: Tip of the Hat to the Jeff, Layla, Kris, and the entire team behind SQLcl.

If you got to this point and are still clueless why \q or \d is convenient, no worries. You miss very little...

No comments: