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

对着背影说爱祢 提交于 2019-12-20 18:10:24

问题


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)

Can anyone tell me why / how to stop it?

CREATE VIEW bob
AS
SELECT *

FROM DUAL;

With SQL*Plus output

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

回答1:


You would use the SET SQLBLANKLINES command:

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

View created


来源:https://stackoverflow.com/questions/1227777/how-do-i-get-sqlplus-to-create-views-tables-with-a-blank-line-in-the-middle-o

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!