如何在 Oracle 中转义保留字?

How do I escape a reserved word in Oracle?(如何在 Oracle 中转义保留字?)
本文介绍了如何在 Oracle 中转义保留字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 TSQL 中,我可以使用类似 Select [table] from tablename 来选择名为table"的列.

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 中转义保留字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)