I'm working through a problem where I need to insert 135 rows into a recently created table with a select statement. I have a handful of NOT NULL constraints on that table and I don't understand how to alter my SELECT to insert the correct information.
Here's what I'm trying to do:
CREATE SEQUENCE target_table_s1 START WITH 1001;
INSERT INTO target_table(colA,ColB,ColC,ColD,ColE)
target_table_s1.NEXTVAL,
(SELECT (colB,colC,ColD)
FROM source_table),
colE;
Where colA is a sequence number (to provide a primary key for the target_table) and colE basically just needs to be something simple like SYSDATE.
Any suggestions on how I can make this work? I know that what I've written above isn't going to work but it's the best way I can illustrate what I'm trying to accomplish. Do I need to find a way to put my sequence inside the select statement so it follows the proper "INSERT INTO SELECT" format?