Oracle SQL*Plus is now support command line history similar to UNIX “history” command. This feature is available from Oracle 12.2.
Enables users to run, edit, or delete previously used SQL*Plus, SQL, or PL/SQL commands from the history list in the current session. You can enable or disable the HISTORY command in the current SQL*Plus session by using the SET HISTORY command.
The HISTORY command enables you to:
List all entries in the command history list.
Run an entry in the command history list.
Edit an entry in the command history list.
Delete an entry from the command history list.
Clear all entries in the command history list.
The following example shows you how to enable or disable command history, and how to check the command history status:
SQL>set history on
SQL> show history
History is ON and set to "100"SQL>set history off
SQL> show history
History is OFFSQL>set history 1000SQL> show history
History is ON and set to "1000"
The following example shows you how to list all entries in the history list:
SQL> show history
History is ON and set to "100"SQL> show user
USER is "SYSTEM"SQL> desc dual
Name Null? Type
-----------------------------------------------------------------------------PRODVARCHAR2(1)SQL> select *from dual;D-XSQL> history 4 run
D-XSQL> history
1 show history
2 show user
3 desc dual
*4 select *from dual;
An asterisk (*) indicates the last used command in the command history list.
The following example shows you how to list all entries in the history list, and then execute the second entry:
SQL> history
1 show history
2 show user
3 desc dual
*4 select *from dual;SQL> history 2 run
USER is "SYSTEM"SQL> history
1 show hist
*2 show user
3 desc dual
4 select *from dual;
Oracle SQL*Plus is now support command line history similar to UNIX “history” command. This feature is available from Oracle 12.2. Enables users to run, edit, or delete previously used SQL*Plus, SQL, or PL/SQL commands from the history list in the current session. You can enable or disable the HISTORY command in the current SQL*Plus session by using the SET HISTORY command.
The HISTORY command enables you to:
List all entries in the command history list.
Run an entry in the command history list.
Edit an entry in the command history list.
Delete an entry from the command history list.
Clear all entries in the command history list. The following example shows you how to enable or disable command history, and how to check the command history status:
SQL> set history on SQL> show history History is ON and set to "100" SQL> set history off SQL> show history History is OFF SQL> set history 1000 SQL> show history History is ON and set to "1000"
The following example shows you how to list all entries in the history list:
SQL> show history History is ON and set to "100" SQL> show user USER is "SYSTEM" SQL> desc dual Name Null? Type ----------------------------------------- -------- ---------------------------- PROD VARCHAR2(1) SQL> select * from dual; D - X SQL> history 4 run D - X SQL> history 1 show history 2 show user 3 desc dual * 4 select * from dual;
An asterisk (*) indicates the last used command in the command history list.
The following example shows you how to list all entries in the history list, and then execute the second entry:
SQL> history 1 show history 2 show user 3 desc dual * 4 select * from dual; SQL> history 2 run USER is "SYSTEM" SQL> history 1 show hist * 2 show user 3 desc dual 4 select * from dual;