【发布时间】:2016-03-04 20:30:23
【问题描述】:
我创建了一个简单的表:
CREATE TABLE Messages
( msgID number(10) PRIMARY KEY,
sender_ID number(10),
time_sent TIMESTAMP,
);
现在我想为其添加一个约束,以确保发送的时间将在 2014 年之后。我写道:
alter table Messages
add constraint year_check
check (time_sent > to_timestamp('2014-12-31 23:59:59'));
但是我得到以下错误:
ORA-30075: TIME/TIMESTAMP WITH TIME ZONE 文字必须在 CHECK 约束中指定
我不想在我的时间戳中有一个 TIME ZONE 并且插入了这样的值:
INSERT INTO Messages VALUES(1, 1, TIMESTAMP '2014-12-24 07:15:57');
如何修复我的约束以消除此错误?
【问题讨论】:
标签: sql oracle constraints ddl