Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Insert multiple rows

497581Jul 12 2006 — edited Jul 13 2006
When I run the following query, I get the error message ORA-01427: single-row subquery returns more than one row.


insert into abc (id, code, detail)
values (ID_COUNT.nextval, (select distinct code from abc) , 'TOTAL AMOUNT').

I understand the error message, but I'm not sure how to make it work. There are about 200 distinct code from abc, and I don't want to manually insert rows for each distinct code.
Is there a way to modify the query and make it work?

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2006
Added on Jul 12 2006
3 comments
346 views