我在查询中定义了多个别名,我想将每个别名的结果写入表tab_1
。但是,当我运行以下查询时,我收到错误
在&INSTS' INSERT'靠近' tab_1'
我写得正确吗?有人可以验证语法还是告诉我如何编写它?请确认我已将逗号放在正确的位置。感谢您的帮助。
func_1 as
( .....),
func_2 as
(.....),
func_3 as
(....),
INSERT INTO TABLE tab_1 select * from func_1,
INSERT INTO TABLE tab_1 select * from func_2,
INSERT INTO TABLE tab_1 select * from func_3;
答案 0 :(得分:0)
使用此模板:
with
func_1 as ( .....),
func_2 as (.....),
func_3 as (....)
INSERT INTO TABLE tab_1
select * from func_1
union all
select * from func_2
union all
select * from func_3;
union all
中的子查询将并行执行。
检查了这句话的解释计划,似乎工作正常:
with func_1 as
( select * from default.dual),
func_2 as
(select * from default.dual)
insert into table default.dual
select * from func_1
union all
select * from func_2