oracle错误,此处不允许使用列 [英] oracle error, column not allowed here

查看:113
本文介绍了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');

这篇关于oracle错误,此处不允许使用列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆