I am trying to copy rows from one table to another and in addition add a new primary key and system date.
INSERT into tableB (id, date, name, type)
SELECT id_seq.nextval, sysdate, name, substr(type, 1, 1)
FROM tableA
WHERE type != 'ABC'
ORDER BY name;
I get the error
sequence number not allowed here
Not sure how and where to specify the new primary key. Thanks from a total newbie in the Oracle SQL world!
----> UPDATE: Final solution
INSERT into tableB (id, date, name, type)
SELECT id_seq.nextval, sysdate, name, type1
FROM (SELECT name, substr(type, 1, 1) as type1
FROM tableA
WHERE type != 'ABC'
ORDER BY name);