How can I insert multiple rows into oracle with a sequence value?

前端 未结 6 645
孤独总比滥情好
孤独总比滥情好 2020-12-13 03:58

I know that I can insert multiple rows using a single statement, if I use the syntax in this answer.

However, one of the values I am inserting is taken from a seque

6条回答
  •  一整个雨季
    2020-12-13 04:34

    This works:

    insert into TABLE_NAME (COL1,COL2)
    select my_seq.nextval, a
    from
    (SELECT 'SOME VALUE' as a FROM DUAL
     UNION ALL
     SELECT 'ANOTHER VALUE' FROM DUAL)
    

提交回复
热议问题