db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe <fischauto...@yahoo.de>
Subject self referencing column
Date Mon, 01 Feb 2010 09:21:07 GMT
Hi,

i have to persist a simple state machine.
my problem is how to insert the first state which should reference itself.

CREATE TABLE state
(
   ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, 
INCREMENT BY 1) constraint STATE_ID_PK primary key,
   NEXT_STATE_ID integer not null constraint STATE_NEYT_STATE_ID 
REFERENCES STATE
)


insert into state values (default,  default)

doesn't work:  "Column 'NEXT_STATE_ID' cannot accept a NULL value."



Mime
View raw message