ORA-02253:此处不允许约束说明 [英] ORA-02253: constraint specification not allowed here
本文介绍了ORA-02253:此处不允许约束说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
create table log_table(
log_id varchar2(1000) primary key,
voter_ID varchar2(1000),
date_logged date
CONSTRAINT abc FOREIGN KEY (voter_ID) REFERENCES voters(voter_ID)
)
当我创建不带日期元素的表时,该表将起作用.但是当我添加date元素时说:
The table works when i create it without date element. But when i add the date element to it says:
ORA-02253:此处不允许约束说明
ORA-02253: constraint specification not allowed here
推荐答案
当我创建不带日期元素的表时,该表将起作用
The table works when i create it without date element
create table log_table(
log_id varchar2(1000) primary key,
voter_ID varchar2(1000), -- comma
CONSTRAINT abc FOREIGN KEY (voter_ID) REFERENCES voters(voter_ID)
)
您必须在约束之前添加,
:
You have to add ,
before constraint:
create table log_table(
log_id varchar2(1000) primary key,
voter_ID varchar2(1000),
date_logged date, -- here
CONSTRAINT abc FOREIGN KEY (voter_ID) REFERENCES voters(voter_ID)
)
我还将log_id
/voter_id
的数据类型重新考虑为(NUMBER/INTEGER).
I would also reconsider datatype of log_id
/voter_id
as (NUMBER/INTEGER).
这篇关于ORA-02253:此处不允许约束说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文