Tom McNish
Tom McNish

Reputation: 95

Column Not Allowed error while inserting rows using sequence values

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?

Upvotes: 0

Views: 256

Answers (1)

Peter Pei Guo
Peter Pei Guo

Reputation: 7870

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

Upvotes: 1

Related Questions