suicide
suicide

Reputation: 800

Inserting a new row into a single column table in apache derby with generated id

I have the following table:

create table indices (
id int primary key generated by default as identity
);

how do I insert a new row?

I have already tried several things I have found, like:

insert into indices values (null);
insert into indices default values;

however that didn't work with derby.

Upvotes: 2

Views: 855

Answers (2)

Bryan Pendleton
Bryan Pendleton

Reputation: 16359

Try "insert into indices values (default)"

Upvotes: 2

Neil Knight
Neil Knight

Reputation: 48547

You need a column to insert into. You have id which is an identity, which means it will already have a value when a new row is inserted. Add a new column and then fill that column in your insert statement.

Upvotes: 0

Related Questions