加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

数据库 – “日期”作为列名称

发布时间:2020-12-12 08:51:02 所属栏目:MsSql教程 来源:网络整理
导读:我有一张叫做日历的表. 其列之一被命名为“日期” 当我想选择日期列时,它给出错误ORA-01747即无效的table.column. select date from calendars 我猜这是因为’date’是pl / sql的保留字.问题是甚至不可能更改列名称: alter table calendars rename column da
我有一张叫做日历的表.

其列之一被命名为“日期”

当我想选择日期列时,它给出错误ORA-01747即无效的table.column.

select date from calendars

我猜这是因为’date’是pl / sql的保留字.问题是甚至不可能更改列名称:

alter table calendars rename column date to date_d

结果是:ORA-00904错误:无效的标识符.

你建议什么

谢谢.

解决方法

你有没有尝试过
select calendars.date from calendars; /* or you could alias "calendars" if you don't want to type so much */

如果这不工作或帮助,是否尝试删除列(也许尝试使用表名前缀calendars.date引用它)?

我也发现这个帖子:How do I escape a reserved word in Oracle?

如果您使用双引号,Oracle似乎会区分大小写

select "date" from calendars;

不一样

select "Date" from calendars;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读