I need to take values from the column of one table that meets certain critera, and create inserts into another table that includes this data.
For example...
{code}
select emp_last_name from emp where emp_first_name like 'B%';
Duncan
Fitzgerald
Johnson
Smith
{code}
I then want to insert these values into another table:
{code}
insert into My_table values (
sequence.nextval,99,99,[last_name]);
{code}
In the example above, I need it to insert a new row into My_table for where the "last_name" is each of the names from the select statement above (Duncan, Fitzgerald,Johnson,Smith).
Based on other similar forum questions it looks like I should be doing something like:
{code}
INSERT INTO MY_TABLE
(SELECT sequence.nextval,
99,
99,
(select EMP_LAST_NAME
FROM EMP
WHERE EMP_FIRST_NAME LIKE 'B%')
);
{code}
But this (obviously) doesn't work!
Appreciate any assistance on this!
KSL.