Oracle SQL -- insert multiple rows into a table with one statement?
insert, oracle, sql
Solution
You can absolutely do this in a single statement!
Try this:
INSERT INTO attribute_list (id, value, name)
SELECT id, 'Y', 'is_leveled'
FROM value_list WHERE val >= 50
Problem
I'd like to do insert N rows that are all identical, except one of the values is different. Specifically, this is what I am trying: ``` insert into attribute_list (id,value,name) values ( select (id,'Y','is_leveled') from value_list where val >= 50 ); ``` So for every value that has a val >= 50, I would insert one row into attribute_list. Can this be done with one insert statement or should I just manually generate these inserts in excel? (note: this is a cooked example simplified to clarify the issue, so no need to attack the needlessness of this specific case)