Tuesday, December 14, 2010

Things I Hate About Using SQLPLUS


1. No last-command macro
Do you remember how to can re-enter previous commands in Terminal / command line windows? By pressing the up or down arrow you can reuse the previous commands that you type. Well, guess what? That doesn't work in sqlplus which employs command line interface :( You have to retype the whole command even though it is a long one. Very irritating! For example:

INSERT INTO SECTION VALUES ('CS161', 1, 'W', '2011', 'Deborah K. Thomas', 'MTRF', to_timestamp('10:00:00', 'hh24:mi:ss'), to_timestamp('10:50:00', 'hh24:mi:ss'), to_date('01/03/2011', 'mm/dd/yyyy'), to_date('03/18/2011', 'mm/dd/yyyy'), 'BH123');
Re-type this if you want to reuse it!

2. Back key doesn't work!
To remove a character from a command, you must hit "Delete" key. That's fine but "Back" key that is supposed to do the same thing doesn't work. In MS Office, Terminal and any text editor, that's one of the functions of "Back" key. But oh no, sqlplus likes to be different. If you accidentally hit "Back" key, you will get a ton of gibberish instead of deleting the previous character!

3. No cursor movement
There is no way you can use the arrows to move your cursor from one place to another in sqlplus. For example, after typing this statement into sqlplus, I discovered that I missed a comma after "PRIMARY KEY":

CREATE TABLE COURSE ( Course_number VARCHAR(10) NOT NULL PRIMARY KEY Title VARCHAR(30) NOT NULL, Credit INT NOT NULL, Requirement VARCHAR(30) );
That means I have to delete everything up to that spot in order to insert a comma and then retype the just deleted words again :(

Stay tuned for my post about temporary solutions to these annoyances.

1 comment:

  1. To fix a mistake, on a fresh SQL line, type edit... make changes in the text file that opens, then copy, close, and paste.

    ReplyDelete