Oracle SQL*Plus 出现空行和多行注释错误

发布于 2024-11-30 10:20:56 字数 939 浏览 0 评论 0原文

我正在尝试使用 SQL*Plus(命令行)执行查询,该查询是一个视图。 SQL*Plus 不支持换行或多行注释 ( /* -- */ )。

当我运行 set sqlblanklines on 时,它返回一个错误:

SQL> set sqlblanklines on
unknown SET option beginning "sqlblankli...".

因此我运行了“help set”,它表示 isql 不支持命令 sqlblanklines(带星号),但我正在使用 SQL *确实加上。

我不知道如何摆脱它,我这几天一直在煎熬我的大脑......

谢谢adv!


更多详细信息

版本是 8.0.6.0.0。

我正在从文件运行脚本。它显示了许多这样的错误:

SQL> start /tmp/sql/pti/APPS.DIBVWIP001.sql 

错误就像

   unknown command beginning "and msi.i..." - rest of line ignored. 
   unknown command beginning "and msi.o..." - rest of line ignored. 
   unknown command beginning "and bic.c..." - rest of line ignored. 
   unknown command beginning "and bbm.b..." - rest of line ignored. 
   For a list of known commands enter HELP and to leave enter EXIT. 

在该块之前有一个空行.. 这就是重点。我无法从脚本中删除空行。

I'm trying to execute a query with SQL*Plus (command line) that is a VIEW. SQL*Plus isn't supporting new lines or multiline comments ( /* -- */ ).

When I run set sqlblanklines on, it returns an error:

SQL> set sqlblanklines on
unknown SET option beginning "sqlblankli...".

So I ran 'help set' and it says that the command sqlblanklines (with an asterisk) is not supported by isql , but I'm using SQL*Plus indeed.

I don't know how to get rid of it, I've been frying my brain off about a couple days...

thanks in adv!!!


More details

The version is 8.0.6.0.0.

I'm running a script from a file. It shows many errors like this:

SQL> start /tmp/sql/pti/APPS.DIBVWIP001.sql 

The errors are like

   unknown command beginning "and msi.i..." - rest of line ignored. 
   unknown command beginning "and msi.o..." - rest of line ignored. 
   unknown command beginning "and bic.c..." - rest of line ignored. 
   unknown command beginning "and bbm.b..." - rest of line ignored. 
   For a list of known commands enter HELP and to leave enter EXIT. 

Before that block there's an blank line.. that's the point. I can't remove the blank lines from the scripts.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2024-12-07 10:20:56

您正在使用该软件的古老版本。所以看现代版本的手册是没有好处的。如果您查阅Oracle 8.0.5 的 SQL*Plus 用户指南 你会发现SET不支持SQLBLANKLINES,这就是错误消息告诉你的。

我不确定为什么多行注释会让您感到悲伤:根据应该支持的文档。然而,SQL*Plus - 尤其是旧版本 - 对我们放置注释的位置很敏感。它不喜欢在 DDL 命令中放置得太早的注释。所以如果你正在做这样的事情……

create  
/*  this is a comment
    which spans several lines
    oh yes
*/
or replace view my_view as select * from dual
/

你可能会遇到一些问题(尽管它在 11g 中运行良好)。

You are working with an ancient version of the software. So it's no good looking at a modern version of the manual. If you consult the SQL*Plus User's Guide for Oracle 8.0.5 you will discover that SET doesn't support SQLBLANKLINES, which is what the error message told you.

I'm not sure why the multi-line comments are giving you grief: according to the documentation that should be supported. However, SQL*Plus - especially older versions - is sensitive to where we place the comments. It doesn't like comments which are placed too early in the DDL command. So if you're doing something like this ...

create  
/*  this is a comment
    which spans several lines
    oh yes
*/
or replace view my_view as select * from dual
/

... you might get some problems (although it runs fine in 11g).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文