0
我想将多行插入到表中。使用select语句插入多行的pl/sql查询
的查询是:
insert into temp(table_name,run_date,table_count)
select 'TABLE_A',sysdate,count(*) from A;
insert into temp(table_name,run_date,table_count)
select 'TABLE_B',sysdate,count(*) from B;
insert into temp(table_name,run_date,table_count)
select 'TABLE_C',sysdate,count(*) from C;
我如何写这篇文章使用PL/SQL的循环?
感谢, 安居房
为什么你需要一个循环?为什么不'UNION'三个查询并立即插入? –
如果你不想硬编码A,B,C,你需要使用动态sql(EXECUTE IMMEDIATE)。 –