oracle错误,此处不允许使用列

oracle错误,此处不允许使用列

问题描述:

我已经有一段时间没有使用Oracle了,所以我有点生锈.

I haven't used Oracle for a while so I'm a bit rusty.

这是我的桌子:

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)
/

我得到:

ORA-00984: column not allowed here

最后指向类型列.我有一种感觉,因为我从未真正使用过DATE字段,所以我做错了.

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.

我做错了什么?

您需要在varchar2值两边加上引号

You need to put quotes round the varchar2 values

类似

insert into calendar(username, 
                     content, 
                     dateContent, 
                     type) 
  values('chris', 
         'assignment due', 
         to_date('01-OCT-2010 13:00','DD-MON-YYYY HH24:MI'), 
         'PUB');