NEXT VALUE geht nicht beim Select!
Die Syntax ist
insert into myfile
(seqfld, feld1, feld2, feld3)
values(next value for myseq, wert1, wert2, wert3)
Du siehst, ein "Insert ... select ... from ..." funktioniert hier nicht.
Du musst dann die Tabelle mit einer AutoIncrement-Feld erstellen und dieses Feld beim Insert dann weglassen:
create mytable (myseq as identity, ...)
PS:
Hier noch mal ein genaues Beispiel aus dem Handbuch:
CREATE TABLE
EMPLOYEE2 (
EMPNO INTEGER GENERATED ALWAYS AS IDENTITY,
ID SMALLINT,
NAME CHAR(30),
SALARY DECIMAL(5,2),
DEPTNO SMALLINT)
Bookmarks