问题
When executing the following statement (as an example) I get an error ORA-00911: Invalid character
"/* it is the end of the world */\nSELECT 1 FROM MyTable;"
Other comments are fine. What's the problem?
We use comments to annotate our Ad-Hoc SQL.
(Oracle11gR2, Windows )
This does not happen via SQL Plus or SQL Developer.
回答1:
If a comment includes the whole word end then the Oracle driver (or server) appears to be interpreting this badly.
If you remove the end word within the comment, the statement executes correctly.
I think this is because it doesn't expect a semi-colon after experiencing an 'end' directive (even though it shouldn't be parsing a comment).
The following statement executes without issue and returns 7.
/* end */\nSELECT 7 FROM MyTable
The following statement raises ORA-00911
/* end */\nSELECT 6 FROM MyTable;
The following statement returns 5
/**/\nSELECT 5 FROM MyTable;
It's likely that Oracle parses the comment because that's how it applies join operation/optimization 'hints'.
来源:https://stackoverflow.com/questions/27062730/ora-00911-invalid-character-via-odbc-adhoc-sql-within-comments