Sample Header Ad - 728x90

PL SQL code that Inserts data from a different table and gives new id values from the same table that the data is being inserted

1 vote
0 answers
176 views
What could I change to make this insert work and give a new ID value on each row I am inserting? Right now it's giving all the inserted rows the same ID number. Sadly, I can't use triggers and sequences so that's not an option.
INSERT INTO shema1.W_ITEM_TABLE("C_ID", "KID", "Number", "LastStatusTime", "AddTime", "Status")
select (select max("C_ID")+1 from shema1.W_ITEM_TABLE), KID, TALRUNIS, NULL,NULL,NULL
from ROBO_SYSTEM;
TABLES:
shema1.W_ITEM_TABLE("C_ID", "KID", "Number", "LastStatusTime", "AddTime", "Status")

ROBO_SYSTEM(KID, TALRUNIS,)
Asked by Kristofers Kaprāns (11 rep)
Mar 1, 2023, 12:24 AM
Last activity: Mar 1, 2023, 08:28 AM