免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1910 | 回复: 5

edit问题 [复制链接]

论坛徽章:
0
发表于 2003-07-07 16:14 |显示全部楼层
我使用的是oracle8.1.7,平台是windows2000.在SQL*PLUS中使用edit
命令编辑命令以后,始终出现错误,为什么?

SQL>; show echo
echo OFF
SQL>; edit
已写入文件 afiedt.buf

  1*  SET ECHO OFF
SQL>; /
SET ECHO OFF
     *
ERROR 位于第 1 行:
ORA-00922: 缺少或无效选项


SQL>; set echo on
SQL>; show echo
echo ON

在edit打开的notepad中的内容是:
SET ECHO OFF
/


求高手指点

论坛徽章:
0
发表于 2003-07-07 16:26 |显示全部楼层

edit问题

实验证明,在edit中设置这些确实不行,但是一般的select却是可以使用的  

那位大虾能不能解释一下啊

论坛徽章:
0
发表于 2003-07-07 16:27 |显示全部楼层

edit问题

再贴一个关于sqlplus的简单介绍

SQL Plus Commands
[Introduction |Line Editing |Using Notepad for editing |Sending results to a file |Retrieving a file ]
Introduction
At the SQL prompt, you can begin typing any SQL command. Upon hitting return (i.e., enter key) the SQL prompt will change to line number prompts. When you are finished typing a command, type / or RUN to execute the SQL command. Also, a semicolon at the end of the SQL command will execute the command immediately after hitting return. In addition to SQL commands, /, and RUN, other commands can be issued at the SQL prompt (a semicolon does not have to follow the nonSQL commands).
DESCRIBE tablename--lists the attributes and their specifications of tablename
EDIT--Places you in an editor (Notepad). The buffer contents are put into the editor
GET filename--Retrieves a file and places it into the buffer
SAVE filename--Saves the buffer to the name file
CLEAR BUFFER--Clears the buffer

--------------------------------------------------------------------------------

Line Editing
One way to change an SQL statement in the buffer is by using the line editor. The following are a list of line edit commands.
LIST or L--Lists the contents of the buffer
LIST n or L n--Lists the contents of line number n in the buffer and makes the line current
LIST * or L *--Lists the current line
LIST m n--Lists the range from m to n line
Append text or A text--Adds to the end of the current line (e.g., "A ," adds a comma to the end of line
INPUT or I--Adds one or more lines after the current line so you can begin adding the text.
CHANGE /text--Deletes text from the current line
CHANGE /oldtext/newtext--Replaces oldtext with newtext in the current line
DEL -- Deletes the current line
Using Notepad for Editing
You can use Notepad to edit the contents of the buffer. There are two ways to enter Notepad.
Use the menus Edit/editor/invoke. In addition here, you can use Edit/editor/define to change the editor. You might check Edit/editor/define prior to editing a buffer to make sure it is set up the way you would like.
Type Edit at the SQL Prompt
When you are finished editing, click on File/exit (in Notepad). Next, type GET buffername at the SQL prompt. The buffer name will be listed a few lines up in SQL Plus upon returning to SQL Plus. Type RUN, to execute the command.
Notepad can also be used to save the buffer contents. Use File/Save As to create a permanent file.

Multiple SQL commands can be typed in Notepad. End each SQL command (except the last one) with a semicolon. After exiting notepad, type Start buffername instead of GET buffername to run all of the commands. Start filename can also be used to execute SQL command that are stored in a file.

Sending the Results to a File
To send queries and their results to a file for later printing (e.g., turning in homework assigments), the spool command is used. On the menu go to FILE/Spool to begin spooling--it will ask for a file name. To quit spooling, go to FILE/Spool and then click on end Spool.
Retrieving a File
To retrieve SQL command from a file use GET filename or START filename. GET filename places the file into the buffer. START filename executes the commands in the file.

论坛徽章:
0
发表于 2003-07-07 16:44 |显示全部楼层

edit问题

发现使用脚本文件却是可以的:
SQL>;EDIT 1.SQL
然后把
SET ECHO OFF
SELECT语句写入
保存
SQL>;START 1.SQL
......


执行是正确的,WHY?

论坛徽章:
0
发表于 2003-07-07 16:53 |显示全部楼层

edit问题

/
专门用来执行sql语句用的
而类似于 set.desc.help等实际上是
sqlplus的命令

所以,是不能通过 /来执行的

你可以直接键入
或者通过
@afiedt.buf
来达到你所需要的效果

ps.我通常会设置
set editfile=.sql
define _EDITOR=vi

ed之后
用 @.sql
来执行!!

论坛徽章:
0
发表于 2003-07-07 17:09 |显示全部楼层

edit问题

多谢了,这么说是 / 的原因了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP