Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: 'history' for SQL commands
David Ross <arragon_at_NOSPAMlineone.net> writes:
> Harald Maier <maierh_at_myself.com> wrote:
>
>>
>>If you are familar with emacs then you might try inside emacs:
>>
>> M-x sql-oracle
>>
>
> Sorry for coming late to this one, but I've recently being playing
> with this, but cannot seem to get multi-line statements to work
> properly. Any pointers?
Try to load the following snippet in your .emacs file. C-j inserts newlines. RET submits the current statement to 'sqlplus'. You will find additional info under
http://www.emacswiki.org/cgi-bin/wiki.pl/SqlPlusNukeLineNo
Harald
--- (defun eat-sqlplus-junk (str) "Eat the line numbers SQL*Plus returns. Put this on `comint-preoutput-filter-functions' if you are running SQL*Plus. If the line numbers are not eaten, you get stuff like this: ... 2 3 4 from v$parameter p, all_tables u * ERROR at line 2: ORA-00942: table or view does not exist The mismatch is very annoying." (interactive "s") (while (string-match " [ 1-9][0-9] " str) (setq str (replace-match "" nil nil str))) str) (defun install-eat-sqlplus-junk () "Install `comint-preoutput-filter-functions' if appropriate. Add this function to `sql-interactive-mode-hook' in your .emacs: \(add-hook 'sql-mode-hook 'install-eat-sqlplus-junk)" (if (string= (car (process-command (get-buffer-process sql-buffer))) sql-oracle-program) (add-to-list 'comint-preoutput-filter-functions 'eat-sqlplus-junk))) (add-hook 'sql-interactive-mode-hook 'install-eat-sqlplus-junk) ---Received on Wed Sep 17 2003 - 08:15:02 CDT