Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Plus command line: Arrow keys not giving previous commands back

Tags:

linux

sqlplus

I am using Oracle 10g Express Edition on Fedora core 5 32+ bit os. The problem is when I use the SQL Plus command line to make SQL statements I can not get the previously typed command back at the prompt when I use the up and down arrow keys on my keyboard. This is quite easy when I am using a shell, but here with this Oracle command line interface it is not working at all. Here is the example as what actually is happening whe I press the up or down arrow keys.

SQL> drop table mailorders;

Table dropped.

SQL> ^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A

like image 618
user1167753 Avatar asked Feb 09 '16 10:02

user1167753


People also ask

How do I use arrow keys in Sqlplus?

In UNIX and Linux, you can use the up-arrow key to display the command history, but the up-arrow key does not work when you are inside SQL*Plus. To enable the up arrow key for Oracle you need to install a special package and the up arrow key will then work inside Oracle.

How do you repeat a command in Sqlplus?

Hit / and then the enter key would rerun the last statement.


1 Answers

The 'l' command will show the last run command (source: krenger.ch):

SQL> l
  1* select owner, count(1) from dba_tables group by owner
SQL>

To get more than that, turn on history (source: dba-oracle):

SQL> set history on
SQL> history
  1  select * from dual;
  2  select sysdate from dual;
  3  show history
like image 111
Jared Avatar answered Oct 14 '22 14:10

Jared