如何在Oracle中转义保留字? [英] How do I escape a reserved word in Oracle?

查看:63
本文介绍了如何在Oracle中转义保留字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在TSQL中,我可以使用Select [table] from tablename之类的东西来选择一个名为表"的列.

In TSQL I could use something like Select [table] from tablename to select a column named "table".

如何对oracle中的保留字执行此操作?

How do I do this for reserved words in oracle?

我已经尝试了方括号,双引号,单引号和反引号,它们不起作用...

I've tried square braces, double quotes, single quotes, and backquotes, they don't work...

为进一步说明,我有一列名为评论"的人.由于这是一个保留字,因此oracle会发抖,试图用它进行选择,这在解析查询时会失败.我试过从表名中选择注释",但是没有用.我会检查情况,然后回来.

As a further clarification, I have a column which someone named comment. As this is a reserved word oracle is chucking a wobbly trying to select with it, its failing when parsing the query. I've tried Select "comment" from tablename but it didn't work. I'll check case and come back.

推荐答案

通过快速搜索,Oracle似乎使用了双引号(",例如"table")并且显然需要正确的大小写 >-而对于任何感兴趣的人,MySQL默认都使用反引号(`),除非设置为使用双引号以实现兼容性.

From a quick search, Oracle appears to use double quotes (", eg "table") and apparently requires the correct case—whereas, for anyone interested, MySQL defaults to using backticks (`) except when set to use double quotes for compatibility.

这篇关于如何在Oracle中转义保留字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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