Since SQLcl is a command line tool, it’s not super helpful to have a huge command history list. How do I mean? Well, in the SQL Developer GUI, we have a History panel. It allows for sorting, filtering, scrolling, etc. So you can go ‘crazy’ and set your History limit to 1000 if you want. But, in SQLcl, we limit the user to their last 100 commands.
Now there are many commands you’ll be running in SQLcl that you won’t necessarily want to be stored in the history. For example, do you want to reserve 1% of your history to remember how to clear the screen?
So in the latest drop, available today, you can now tell SQLcl NOT to store certain things.
Scroll down to the bottom of the SQL Developer downloads page to get to the 12MB SQLcl package.
But, by default, the history will store EVERYTHING. So you have to take extra step(s) to prevent things going into the history.
This has changed with the official 4.2 SQLcl Release – please go here to see how to manage your BLACKLIST.
The developers know that there will be lots of questions as they had new features, above and beyond what SQL*Plus offers. So you’ll find lots of good stuff in the HELP.
Ok, so I don’t want to see SET commands or where I go to clear the screen, and a couple of other things.
If you already have a SQL History, you’ll need to clear it first, and then going forward these items won’t go in. Or just let them age out…
HISTORY CLEAR — this will clear your history 🙂
Ok, now maybe you’re going to work on a query. And you know it’s not going to work for awhile. Or, maybe you’re like me and you rarely get the SQL just right on your first try. In that case you MAY not want to save the failures.
So I’m going to disable bad SQL going into the history.
I don’t think I’ll run in this mode that often. If I do turn it on, it will be on a short term basis, and then I’ll probably turn it off.
Bumping Up your SQLcl History Limit
If you don’t like 100, you can change it.
script var MultiLineHistory =Java.type("oracle.dbtools.raptor.console.MultiLineHistory"); MultiLineHistory.getInstance().setMaxItems(250); /
Add this to your login.sql script. 250 will be your new max.