Column Not Allowed error while inserting rows using sequence values

ぐ巨炮叔叔 提交于 2019-12-13 04:43:18

问题


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?


回答1:


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');


来源:https://stackoverflow.com/questions/26198292/column-not-allowed-error-while-inserting-rows-using-sequence-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!