sqloracle-databasecommentsora-00911

ORA-00911 Error when using double hyphen in comment


I have encountered an Problem on my Oracle 11 Express installation running on Windows Xp 32Bit.

When I run a SQL-Script via Ant an Ora-00911 error is thrown every time when I use a double hyphen. When I run the exactly same code on my Oracle installation on Unix it works like a charm.

This is my query:

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

Is there any configuration that must be adapted? It seems to me that there is some kind of syntax check that thinks there is an SQL-Comment inside the comment-text.

Any idea what's causing this error?


Solution

  • This is an Ant bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=43413

    You need to include the attribute keepformat="true" in your sql task:

    <sql driver="oracle.jdbc.OracleDriver"
         url="jdbc:oracle:thin....."
         userid="scott"
         password="tiger"
         keepformat="true">
    
       comment on table foo is 'Commenttest -- Testingtable';
    </sql>