oracle 如何让 SQL*Plus 创建在 create 语句中间有一个空行的视图/表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1227777/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:43:02  来源:igfitidea点击:

How do I get SQL*Plus to create views / tables with a blank line in the middle of the create statement?

oraclesqlplus

提问by MPritchard

I wish to create some views using SQL*Plus via script, but seem to hit a problem if a developer has placed a blank line mid statement. The following statement works fine in TOAD / PL/SQL developer etc, but fails in SQL*Plus. (This is usually scripted, but entering it manually gives exactly the same error)

我希望通过脚本使用 SQL*Plus 创建一些视图,但如果开发人员放置了一个空行 mid 语句,似乎会遇到问题。以下语句在 TOAD / PL/SQL developer 等中工作正常,但在 SQL*Plus 中失败。(这通常是脚本化的,但手动输入会给出完全相同的错误)

Can anyone tell me why / how to stop it?

谁能告诉我为什么/如何阻止它?

CREATE VIEW bob
AS
SELECT *

FROM DUAL;

With SQL*Plus output

使用 SQL*Plus 输出

SQL> CREATE VIEW bob
  2  AS
  3  SELECT *
  4
SQL> FROM DUAL;
SP2-0042: unknown command "FROM DUAL" - rest of line ignored.

回答by Vincent Malgrat

You would use the SET SQLBLANKLINEScommand:

您将使用以下SET SQLBLANKLINES命令:

SQL> SET SQLBLANKLINES on
SQL>
SQL> CREATE VIEW bob
  2  AS
  3  SELECT *
  4  
  5  FROM DUAL;

View created