How do I use a SELECT with an INSERT statment?
Posted on 2007-12-05
I wish to insert a series of rows into a table. The rows are obtained as a result of an intersection between two other tables. For example:
INSERT INTO A values (b_id,'xxx','yyy',...)
SELECT b_ id
WHERE b_bill_date = to_date('04-DEC-2007','DD-MM-YYYY')
SELECT DISTINCT c_id
FROM c, d
WHERE c_term_code = '200720'
AND d_rsts_code = d_code
AND d_incl_sect_enrl = 'Y';
What is the correct syntax for this query?