ORA-00911在注释中使用双连字符时出错

时间:2012-11-23 14:21:24

标签: sql oracle comments ora-00911

我在Windows Xp 32Bit上运行的Oracle 11 Express安装遇到了问题。

当我通过Ant运行SQL脚本时,每次使用双连字符时都会抛出Ora-00911错误。当我在Unix上的Oracle安装上运行完全相同的代码时,它就像一个魅力。

这是我的疑问:

comment on table X.TABLE is 'Commenttest -- Testingtable';

是否有必须调整的配置?在我看来,有一种语法检查认为注释文本中有一个SQL-Comment。

知道是什么导致了这个错误吗?

3 个答案:

答案 0 :(得分:3)

这是一个Ant bug:https://issues.apache.org/bugzilla/show_bug.cgi?id=43413

您需要在sql任务中包含属性keepformat="true"

<sql driver="oracle.jdbc.OracleDriver"
     url="jdbc:oracle:thin....."
     userid="scott"
     password="tiger"
     keepformat="true">

   comment on table foo is 'Commenttest -- Testingtable';
</sql>

答案 1 :(得分:2)

看起来你错过了收盘单引号:

comment on table X.TABLE is 'Commenttest -- Testingtable';
                                                        ^----add this single quote

答案 2 :(得分:1)

您缺少终止报价,请添加如下:

     comment on table X.TABLE is 'Commenttest -- Testingtable';