为什么ORACLE在命令中不允许连续的换行符? [英] Why doesn't ORACLE allow consecutive newline characters in commands?

查看:242
本文介绍了为什么ORACLE在命令中不允许连续的换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写:

  • :创建表人员(
  • :名称CHAR(10),
  • :
  • :ssn INTEGER);

并将其保存到文件"a.sql"(冒号代表行的开头,不在实际代码中.)

and save it to a file "a.sql" (colon represents beginning of line, is not in actual code.)

如果我随后通过在SQL * Plus命令提示符下键入"@a"来运行它,它将告诉我以"ssn"开头的行不会被识别为命令,因此会被忽略.

If I then run it by typing "@a" in the SQL*Plus command prompt, it will tell me that the line starting with "ssn" is not recognized as a command, and is ignored.

据我所知,如果sqlplus在一行中遇到多个换行符,它似乎会终止命令.这是正确的说法吗?如果是这样,有谁知道这是否有必要/为什么选择这样做?

From what I gather, it seems that sqlplus terminates a command if it encounters multiple newline characters in a row. Is this an accurate statement? If so, does anyone know if this is necessary/ why it chooses to do this?

推荐答案

我不知道为什么,但是完全空白的行会终止SQL * Plus中的命令.

I don't know about the why, but a completely blank line terminates a command in SQL*Plus.

引用 SQL * Plus文档:

结束SQL命令: 您可以通过以下三种方式之一结束SQL命令:

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

  • 以分号(;)
  • 本身在一行上带有斜杠(/)
  • 空白行

您还可以更改使用SET SQLBLANKLINES处理空白行的方式

You can also change how blank lines are treated with SET SQLBLANKLINES

SQLBL [ANKLINES] {ON | OFF}

控制SQL * Plus是否允许SQL命令或脚本中的空白行. ON将空行和换行解释为SQL命令或脚本的一部分.默认值为OFF,不允许在SQL命令或脚本或脚本中出现空白行或换行.

Controls whether SQL*Plus allows blank lines within a SQL command or script. ON interprets blank lines and new lines as part of a SQL command or script. OFF, the default value, does not allow blank lines or new lines in a SQL command or script or script.

输入BLOCKTERMINATOR可以停止SQL命令输入,而无需运行SQL命令.输入SQLTERMINATOR字符以停止SQL命令输入并运行SQL语句.

Enter the BLOCKTERMINATOR to stop SQL command entry without running the SQL command. Enter the SQLTERMINATOR character to stop SQL command entry and run the SQL statement.

这篇关于为什么ORACLE在命令中不允许连续的换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆