使用序列值插入行时出现不允许列错误 [英] Column Not Allowed error while inserting rows using sequence values

查看:43
本文介绍了使用序列值插入行时出现不允许列错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地为罪犯表中的criminal_id 列创建了一个序列,但是当我尝试插入新行时,出现不允许列"错误.这是我运行的语句:

I've already successfully created a Sequence for the criminal_id column in the criminals table, but when I try to insert a new row, I get a "column not allowed" error. Here's the statement I run:

INSERT INTO criminals (criminal_id, last, first)
VALUES (criminals_criminal_id_seq.NEXTVAL, Capps, Johnny);

我收到的错误消息说我的错误在第二行,并指出:此处不允许使用列."我做错了什么?

The error message I get back says my error is in the second line, and states: "column not allowed here." What am I doing wrong?

推荐答案

你漏掉了一些引号,否则它认为那些没有引号的是列名,因此错误信息:

You missed some quotes, otherwise it thought those unquoted are column names, thus that error message:

INSERT INTO criminals (criminal_id, last, first)
VALUES (criminals_criminal_id_seq.NEXTVAL, 'Capps', 'Johnny');

这篇关于使用序列值插入行时出现不允许列错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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