oracle 错误,此处不允许列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3924558/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
oracle error, column not allowed here
提问by Dorka
I haven't used Oracle for a while so I'm a bit rusty.
我有一段时间没有使用 Oracle,所以我有点生疏。
This is my table:
这是我的表:
create table calendar(
username VARCHAR2(12),
content VARCHAR2(100),
dateContent DATE,
type CHAR(3) CHECK (type IN ('PUB', 'PRV')));
But when I try to insert a value like this:
但是当我尝试插入这样的值时:
insert into calendar
(username, content, dateContent, type)
values
(chris, assignment due, to_date('01-OCT-2010 13:00','DD-MON-YYYY HH24:MI'), PUB)
/
I am getting:
我正进入(状态:
ORA-00984: column not allowed here
pointing to the type column at the end. I have a feeling I'm not getting something right with the DATE field as I've never really used it.
指向最后的类型列。我有一种感觉,因为我从未真正使用过 DATE 字段,所以我没有正确使用它。
What have I done wrong?
我做错了什么?
回答by Richard
You need to put quotes round the varchar2 values
您需要在 varchar2 值周围加上引号
Something like
就像是
insert into calendar(username,
content,
dateContent,
type)
values('chris',
'assignment due',
to_date('01-OCT-2010 13:00','DD-MON-YYYY HH24:MI'),
'PUB');
回答by codaddict
Could it be because type
is a Oracle reserved word?
可能是因为type
是Oracle 保留字?
Looks like this is not an issue. Read the comment by APC.
看起来这不是问题。阅读 APC 的评论。
I'm not deleting this answer because I find the comment useful.
我不会删除这个答案,因为我发现评论很有用。