繁体   English   中英

在nextval Oracle SQL中插入多个具有多个值的行

[英]Insert multiple rows with multiple values nextval Oracle SQL

我正在尝试将具有多个值的两行和test_id.nextval插入到现有数据框中,而不在代码中包含列标题:

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);

我收到了错误: sequence number not allowed here 所以我删除了序列号。 然后错误not enough values发生。 如何使用nextval ids将多行插入现有表?

尝试这个:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM