Oracle 10g:插入多行
Oracle 10g: Inserting multiple rows
我有以下 :
select dte, wm_concat(issue) as issues
from ((select date_a as dte, issue from t where date_a is not null) union all
(select date_b, issue from t where date_b is not null)
) di
group by dte
order by dte;
returns 多行,例如:
DTE | ISSUES
-----------+---------
01/JUN/91 | EE
01/JUN/03 | EE
01/JAN/06 | HH
01/AUG/06 | EE
01/AUG/08 | EE,HS,HE
我想将这些记录插入 table。
问题
插入语句应该怎么写?我是否应该使用游标,因为 INSERT 似乎一次只能处理一行?
使用 select 作为插入的来源:
insert into some_table (dte, issues)
select dte, wm_concat(issue) as issues
from (
select date_a as dte, issue
from t
where date_a is not null
union all
select date_b, issue
from t
where date_b is not null
) di
group by dte;
无需将 UNION 的各个查询放在括号之间。
我有以下
select dte, wm_concat(issue) as issues
from ((select date_a as dte, issue from t where date_a is not null) union all
(select date_b, issue from t where date_b is not null)
) di
group by dte
order by dte;
returns 多行,例如:
DTE | ISSUES
-----------+---------
01/JUN/91 | EE
01/JUN/03 | EE
01/JAN/06 | HH
01/AUG/06 | EE
01/AUG/08 | EE,HS,HE
我想将这些记录插入 table。
问题
插入语句应该怎么写?我是否应该使用游标,因为 INSERT 似乎一次只能处理一行?
使用 select 作为插入的来源:
insert into some_table (dte, issues)
select dte, wm_concat(issue) as issues
from (
select date_a as dte, issue
from t
where date_a is not null
union all
select date_b, issue
from t
where date_b is not null
) di
group by dte;
无需将 UNION 的各个查询放在括号之间。