MAYDAY !
On thousands of web pages, I read that you have to type "define
_editor=vi" under SQLPLUS to have a vi-like cmd line but it did never
work for me.
What am I doing wrong ? (I precise that I already tried with the full
path of vi , ie "define _editor=/usr/bin/vi".
Thanks a lot in advance for your help.
Because it definitely does work!! No 'vi -like cmd', but you *are*
actually in vi!!
--
Sybrand Bakker
Senior Oracle DBA
I don't think you can have a command-line vi inside sql*plus like this.
"define _editor=vi" only sets the editor to use when you type the "EDIT"
command (to change your previous sql*plus command).
Matthias
As this innocent life form can not speak for himself to guide us into the
unknown, we beg thee to tell us the answer to these hidden questions:
what are the operating system and database version he is using?
Then and only then might we have a clue to the directions we need to look
to help this one into the light.
In the mean time, let us expend valuable energies, perhaps uselessly,
with an example ...
poppa@fuzzy:~> whereis vi
vi: /bin/vi /usr/bin/vi /usr/share/man/man1/vi.1.gz /usr/share/man/man1p/vi.1p.gz
pop2@fuzzy:~> uname -a
Linux fuzzy 2.6.11.4-21.10-default #1 Tue Nov 29 14:32:49 UTC 2005 i686 i686 i386 GNU/Linux
poppa@fuzzy:~> sqlplus hr/hr
SQL*Plus: Release 10.2.0.1.0 - Beta on Mon Jan 23 08:14:35 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
SQL> define _editor=/usr/bin/vi
SQL> !ls test.sql
ls: test.sql: No such file or directory
SQL> edit test.sql
[goes into full screen vi mode]
select * from dual;
~
~
~
~
~
-- INSERT -- 1,20 All
ESC
ZZ
SQL> !ls test.sql
test.sql
SQL> @test
DUM
---
X
--
Hans Forbrich
Canada-wide Oracle training and consulting
mailto: Fuzzy.GreyBeard_at_gmail.com
*** Top posting [replies] guarantees I won't respond. ***
Matthias
I agree.
It was early when I answered, I was grumpy (still am since coffee's not
kicked in yet), and was deliberately being obtuse, as OP did not provide
the environment. (Which seems to be a growing epidemic - again.)
Of course, to answer the OP's question, there are a number of ways, but
some are OS dependent. Howard has shown a beauty at dizwell.com, but
(iirc) it's for command-line Sqlplus in Windows.
And, of course, there is the little known (and very limited) native editor.
I'm always amused at the reaction ("I didn't know you could do that")
when I correct my sql directly like
pop2@fuzzy:~> sqlplus hr/hr
SQL*Plus: Release 10.2.0.1.0 - Beta on Mon Jan 23 09:26:35 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
SQL> select usernm
2 from user_objects
3
SQL> i
3 wherte object_name like 'C%'
4
SQL> 1
1* select usernm
SQL> c/nm/name, object_name
1* select username, object_name
SQL> l
1 select username, object_name
2 from user_objects
3* wherte object_name like 'C%'
SQL> c/rt/r
3* where object_name like 'C%'
SQL> l
1 select username, object_name
2 from user_objects
3* where object_name like 'C%'
SQL> c/username
1* select , object_name
SQL> c/,
1* select object_name
SQL> l
1 select object_name
2 from user_objects
3* where object_name like 'C%'
SQL> /
OBJECT_NAME
--------------------------------------------------------------------------------
COUNTRIES
COUNTRY_C_ID_PK
SQL>
Painful, yes. But it has it's uses. <g>
Then there are tips like http://vim.sourceforge.net/tips/tip.php?tip_id=41
And iSQLPlus.
And, of course, Raptor - which pretty much nullifies the question
entirely. I can't wait until it's production.
I know, question was about vi, but the other half of the world uses
Emacs, right? Emacs has function sql-oracle (actually it has several
similar functions, almost one per database system, like sql-mysql etc.)
which runs sqlplus inside Emacs. So you can edit commands, view previous
results etc. inside Emacs. Quite often, instead of sqlplus, I write
emacs -f sql-oracle onto the shell.
--
Arto Viitanen, CSC Ltd
Espoo, Finland
That is not supposed to give you "a vi-like cmd line". It sets the
editor to be invoked when you type "ed [filename]". Does that part
work? Do you have a /usr/bin/vi executable?
I was trying out the RSS feed, which displays just the first post e.g:
http://groups.google.com/group/comp.databases.oracle.server/msg/b7789013162be612
which gives a neat illusion that you are looking at an unanswered post.
So I'm blaming that.
Pretty painfull, yes :-) But actually, it's really approaching what I
was looking for. By the way, I reckon I didn't understand at all the
use of "define _editor=vi".
THanks for your answer.