ORA-00911:通过ODBC,Adhoc SQL无效的字符-在注释中? [英] ORA-00911: Invalid Character via ODBC, Adhoc SQL - within comments?

查看:123
本文介绍了ORA-00911:通过ODBC,Adhoc SQL无效的字符-在注释中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行以下语句时(例如),出现错误ORA-00911: Invalid character

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?

我们使用注释来注释Ad-Hoc SQL.

We use comments to annotate our Ad-Hoc SQL.

(Oracle11gR2,Windows)

(Oracle11gR2, Windows )

这不是通过SQL Plus或SQL Developer发生的.

This does not happen via SQL Plus or SQL Developer.

推荐答案

如果注释中包含整个词end,则Oracle驱动程序(或服务器)似乎对此解释不佳. 如果删除注释中的end词,则该语句将正确执行.

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.

我认为这是因为遇到'end'指令后,即使它不应该解析注释,也不会期望使用分号.

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).

以下语句执行没有问题并返回7.

The following statement executes without issue and returns 7.

/* end */\nSELECT 7 FROM MyTable 

以下陈述提出了ORA-00911

The following statement raises ORA-00911

/* end */\nSELECT 6 FROM MyTable;

以下语句返回5

/**/\nSELECT 5 FROM MyTable;

Oracle可能会解析注释,因为这就是它应用联接操作/优化提示"的方式.

It's likely that Oracle parses the comment because that's how it applies join operation/optimization 'hints'.

这篇关于ORA-00911:通过ODBC,Adhoc SQL无效的字符-在注释中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆