10 Reasons You’re Going to LOVE the History Feature in Oracle SQLcl

thatjeffsmith SQL Developer 3 Comments

Tell Others About This Story:

I’m out on vacation this week, but you’re in luck. I have to do the Southwest 24 hour check-in thing, so that means I’m stuck on my laptop for a few minutes.

If you’re a command-line kind of guy or gal, then you know all about SQL*Plus. If you’ve spent any time here, then you also know all about SQLcl – our new, modern CLI for Oracle Database.

You’ve probably seen that the tool automatically keeps track of your previous work, and that you can recall it. We call this feature, ‘History’ – and that’s the same name of the command.

Here’s 10 reasons you’re gonna love using this feature.

1. It’s on by default.

You don’t have to do anything to turn it on – it just works out of the box.

2. You don’t need to learn any new commands.

You can just use the up or down arrow keys to cycle through your recent history.

3. You don’t have to worry about exposing critical information, like passwords.

Out of the box, SQLcl does NOT store commands like ‘CONNECT.’ You also don’t have to worry about filling up your history list with a bunch of SET commands. Of course, you can always set the blacklist to dis-allow anything you want.

Use SET HISTORY BLACKLIST to do just that

Use SET HISTORY BLACKLIST to do just that

4. The history isn’t just for this session.

The application stores your history in your OS user $HOME directory, and it’s available from one session to the next.

5. You can change the history limit.

We save 100 of your last ‘things’ out of the box. If you don’t like this limit, you can just change it.

For a CLI, I think 100 is enough for most folks...

For a CLI, I think 100 is enough for most folks…

6. We don’t save ‘bad’ queries in the history…

If your query or script fails, it won’t go into the history. But, you might not like that, so you can change it. Just toggle using the SET HISTORY command.

7. We’re not just saving queries.

If you run an anon block, we’re saving those too. Oh, and they count as just a single entry or ‘statement.’

Use HISTORY FULL command to see more than just the first few characters of your history item.

Use HISTORY FULL command to see more than just the first few characters of your history item.

8. Curious how much time said query took to run?

We auto-magically append the SET TIMING ON numbers to your queries. You can see these with the HISTORY TIME command.

9. Run the same things, over and over?

Don’t worry, you won’t see your

SELECT *
FROM HR.EMPLOYEES;

queries filling up your history list – we just store it once. And if you run HISTORY USAGE, you’ll see just how many times each item has been executed in SQLcl.

10. If you can’t remember anything else, just remember ‘HISTORY.’

Type it. Run it. See your list. Find the item you want, then add it to the buffer via a ‘history #.’ That history item will now be ready for you to execute or edit.

Oh, and about those Southwest boarding passes…

A49 – A52 acquired for the family. I wonder what’s happened in the real-world these past few days?

Tell Others About This Story:

Comments 3

  1. Jeff,

    I am using the latest build of SQLCI (4.2.0), thought “connect” command got backlisted, still see that using HISTORY USAGE.

    [email protected]> conn rajesh/[email protected]
    Connected.

    [email protected]> conn demo/[email protected]
    Connected.

    [email protected]> history full;
    1 conn sys/[email protected] as sysdba

    2 $d:\

    3 $dir

    4 $dir d:\app

    5 conn rajesh/[email protected]

    6 conn demo/[email protected]

    [email protected]> show history
    HISTORY
    enabled
    blacklist: show,history,connect,set
    Do not show failed statements

    [email protected]>

    Did i miss something ?

    1. thatjeffsmith Post
      Author

Leave a Reply

Your email address will not be published. Required fields are marked *