I have 2 tables: an old_table that only contains 'Description' (not all description's are distinct)
a new_table with 2 columns; pk_ID and Descr
I'm going to populate new_table with 'Description' using an insert select. I wanted my pk_ID to
automatically generate a sequential number for each unique description i'm inserting.
So I created a SEQUENCE (next_seq) to handle this, but am not sure the following can be done according to what i've read online.
CREATE SEQUENCE next_seq
START WITH 1
INCREMENT BY 1
INSERT INTO new_table (pk_ID, Descr)
SELECT DISTINCT next_seq.nextval, Description
Is the above sql correct ? If not then how do i generate the next sequential number for each distinct record i'm inserting into new_table?