I am trying to come up with a DB2 SQL statement that does the following, but I am not sure if this is allowed.
I know that it's possible to insert into tableA ( ... ) Values (?,?,?,...)
and then assign values to those parameters ?.
Is it possible to pre-defined the value of one of the parameter?
For example, one of the column that I am trying to insert is the ID column and I would like to make it something like select max(id) + 1 from tableA.
This is what I am trying to get to - is this syntax possible in db2?
insert into tableA (ID, Text1, Text2) VALUES (select max(id)+1 from tableA, ?, ?)
Anyways - any help would be appreciated!
thanks!!
CREATE TABLE mytable (id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, ...)