Last Identity value in Derby
ij> create table t1(c1 int generated always as identity, c2 int);
0 rows inserted/updated/deleted
ij> insert into t1(c2) values (8);
1 row inserted/updated/deleted
ij> values IDENTITY_VAL_LOCAL();
1
-------------------------------
(cf. Derby Reference Doc: CREATE TABLE statement and IDENTITY_VAL_LOCAL funtion ).
We actually need to use this form which allows rows to be inserted that include an id already.
CREATE TABLE role
(
id int generated by default as identity,
name varchar(20) NOT NULL,
description varchar(64),
CONSTRAINT role_pkey PRIMARY KEY (id)
);
0 Comments:
Post a Comment
<< Home