create table tb2009 as select * from a where year=2009; create table tb2008 as select * from a where year=2008; --或者先建好两个表再insert直接装载 --创建表只需要表结构 create table tb2009 as select * from a where 1=2; insert /*+append*/ into tb2009 select * from a where year=2009;
写个匿名块,循环操作. 表名形式 固定前缀+年份. 使用动态sql.execute immediate 来执行create table as
create table tb2008 as select * from a where year=2008;
--或者先建好两个表再insert直接装载
--创建表只需要表结构
create table tb2009 as select * from a where 1=2;
insert /*+append*/ into tb2009 select * from a where year=2009;
表名形式 固定前缀+年份.
使用动态sql.execute immediate 来执行create table as