如何处理以保留Sql关键字命名的表列? [英] How To Handle Table Column Named With Reserved Sql Keyword?

查看:84
本文介绍了如何处理以保留Sql关键字命名的表列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧表,该表有一个名为"RANK"的列,该名称是Oracle中的关键字, 我不知道该表是如何创建的,我无法重命名该列,因为它被其他应用程序使用. 现在我需要在此表中插入数据:

I have an old table that has a column named "RANK" and this name is a keyword in Oracle, I don't know how this table created and I can't rename this column because it is used by other applications . Now I need to insert data in this table :

insert into mytbl (RANK)
select RANK from other_table

执行此查询时,出现以下错误:

when executing this query I got the following error :

ORA-00907:缺少右括号

请问如何解决这个问题?

Kindly, how can I solve this problem?

谢谢.

推荐答案

Oracle使用双引号"来转义保留字.

Oracle uses double quotes " to escape reserved words.

insert into mytbl ("RANK")
select "RANK" 
from other_table

另一个要注意的是,Oracle也需要正确的大小写.

One other note, Oracle requires correct case as well.

这篇关于如何处理以保留Sql关键字命名的表列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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