Sqlplus联机文档学习

地址:http://download.oracle.com/docs/cd/E11882_01/server.112/e16604/ch_four.htm#i1039255

[原文] Ending a SQL Command

You can end a SQL command in one of three ways:

  • with a semicolon (;)

  • with a slash (/) on a line by itself

  • with a blank line

A semicolon (;) tells SQL*Plus that you want to run the command. Type the semicolon at the end of the last line of the command, as shown in Example 4-3, "Entering a SQL Command", and press Return or click Execute. SQL*Plus processes the command and also stores the command in the SQL buffer. See The SQL Buffer for details. If you mistakenly press Return before typing the semicolon, SQL*Plus prompts you with a line number for the next line of your command. Type the semicolon and press Return again or click Execute to run the command.

A slash (/) on a line by itself also tells SQL*Plus that you wish to run the command. Press Return at the end of the last line of the command. SQL*Plus prompts you with another line number. Type a slash and press Return again or click Execute. SQL*Plus executes the command and stores it in the buffer.

A blank line in a SQL statement or script tells SQL*Plus that you have finished entering the command, but do not want to run it yet. Press Return at the end of the last line of the command. SQL*Plus prompts you with another line number.

Note:

You can change the way blank lines appear and behave in SQL statements using the SET SQLBLANKLINES command. For more information about changing blank line behavior, see the SET command.

To execute commands this way, press Return again; SQL*Plus now prompts you with the SQL*Plus command prompt. SQL*Plus does not execute the command, but stores it in the SQL buffer. See The SQL Buffer for details. If you subsequently enter another SQL command, SQL*Plus overwrites the previous command in the buffer.

[译文]

结束SQL命令

你可以通过下面三种方式来结束SQL命令:

  • 使用一个分号(;);
  • 在单独一行使用一个斜划线(/);
  • 使用一个空行;

键入分号就是告诉Sqlplus你将要执行命令,通常在命令最后一行的末尾;像例子中表示的那样:Sqlplus进程将SQL命令存储在SQL缓冲中,可以查看SQL细节。如果你在输入分号之前错误的按了回车键,Sqlplus将会提示你在下一行继续输入命令,直到你键入分号然后按回车键执行命令为止。

斜划线独自占一行的意思就是告诉Sqlplus你将要执行命令了。在命令的最后 一行按回车,Sqlplus提示你下一个行号,然后可以键入斜划线,然后按回车,则执行命令。Sqlplus将执行的命令存储在缓冲里。

空行在SQL语句或脚本中表示你想结束键入命令,但不执行。当你在命令的最后一行按回车键,Sqlplus提示你下一行号。

注意:

你可以通过使用命令SET SQLBLANKLINES来改变SQL语句显示空行的方式。相关更多请看SET命令。

通过这种方式执行命令,请再按回车一次,Sqlplus提示你当前在Sqlplus命令提示状态,Sqlplus不能执行命令,但命令存储在SQL缓冲中。可以查看SQL缓冲,如果你随后键入其它命令,在缓冲中上一条命令将被替换。