【发布时间】:2017-05-02 17:33:13
【问题描述】:
我想使用 Oracle SQL 在一个 insert into 语句中的表中插入 2 行。
此代码有效:
insert into a_glw select tt.*, work_id_seq.nextval from
(select 11111, 'one text', 12345, 'new text', NULL,
'some text', 'nice text', 'test', 'text', 'great text'
from dual
union all
select 11111, 'one text', 12345, 'new text', NULL,
'some text', 'nice text', 'test', 'text', 'great text'
from dual) tt;
当我将值 test 更改为 text 时,此代码会产生错误 00918. 00000 - "column ambiguously defined":
insert into a_glw select tt.*, work_id_seq.nextval from
(select 11111, 'one text', 12345, 'new text', NULL,
'some text', 'nice text', 'text', 'text', 'great text'
from dual
union all
select 11111, 'one text', 12345, 'new text', NULL,
'some text', 'nice text', 'test', 'text', 'great text'
from dual) tt;
在一个 select 语句中插入相同的值似乎是个问题。我怎样才能解决这个问题?
【问题讨论】:
标签: sql oracle insert-into union-all