Forum Stats

  • 3,758,935 Users
  • 2,251,478 Discussions
  • 7,870,439 Comments

Discussions

is it possible to run something like "history XX run" with sqlcl

user499562
user499562 Member Posts: 3
edited Jul 5, 2018 3:36PM in SQLcl

Hi,

I'm playing around with sqlcl and I was wondering if it is possible to re-run a command (without copy/pasting it in the console) that is in the history buffer.

f.ex. running the history command returns a lot of entries, and if I would like to rerun the following commands f.ex:

48  select * from employees;

49  select * from regions;

In sqlplus you can do something like:

history 48 run

or

history 49 run

and the commands are run again.

>help history

doesn't seem to have any similar commands

history [<index> | FULL | USAGE | SCRIPT | TIME | CLEAR (SESSION)?]

Is it possible to do the same in sqlpl or something similar?

Or would you have to copy/paste it, or scroll history with the up/down keys (+ enter)?

Thanks a lot!

Didier

Glen Conway

Best Answer

  • Glen Conway
    Glen Conway Member Posts: 859 Gold Badge
    edited Jul 4, 2018 3:21PM Accepted Answer

    Note that history <number> places the statement in the buffer so that

    history 48run

    or

    history 48/

    will do what you want.  And since the syntax you mention works in sqlplus, maybe the SQL Developer/SQLcl team will add support for that in a future release in order to keep closer compatibility with sqlplus.

    Cheers

    user499562

Answers