1

I'm trying to insert 2 rows with several values and test_id.nextval into an existing dataframe without including the column headings in the code:

insert into x
    select * from
        (select 12345, 'text', test_id_seq.nextval from dual
    union all
        select 23589, 'other text', test_id_seq.nextval from dual);

I got the error: sequence number not allowed here. So I removed the sequence number. Then the error not enough values occured. How can I insert multiple rows into an existing table with nextval ids?

4

1 回答 1

2

Try this:

    insert into x
    select tt.* , test_id_seq.nextval from
    (select 12345, 'text' from dual
    union all
    select 23589, 'other text' from dual) tt;
于 2017-04-27T16:23:51.817 回答