insert into table1(c1,c2,c3) select ( c1,c2,c3 from table2 where ... )
create procedure aaaa(dtDate in date,dtDate2 in date,District char(8),Vocation char(10),BelongStyle varchar(10)) is begin create TEMPORARY table QueryTmp2( 日期 date, 主营业务收入本期 number null, 主营业务收入同月比增减 number null, 主营业务收入累计 number null, 计征增值税同期比增减 number null )on commit preserve rows;; while dtDate<=dtDate2 loopinsert into QueryTmp2( select dtDate, t.C01Uzyywsrje1 as 主营业务收入本期, t.C01Uzyywsrje2 as 主营业务收入同月比增减, t.C01Uzyywsrje3 as 主营业务收入累计, t.C01Ujzzzsxse4 as 计征增值税同期比增减 from T_sscwzb t T_qyjbxx a D_xzqh c D_sshy d D_qyjjlx e Where instr(c.db_bhc,District)<>0 and (instr(e.db_dmc,BelongStyle)<>0) and (d.db_ssdl=Vocation or substr(d.dbsshy,1,length(Vocation))=Vocation) and (to_char(a.zcrq,'yyyy') <= to_char(dtDate,'yyyy')) and (to_char(a.zcrq,'yyyy') >= to_char(add_months(dtDate,-12),'yyyy')); ); end loop; end;
insert into QueryTmp2 select dtDate, t.C01Uzyywsrje1 as 主营业务收入本期, t.C01Uzyywsrje2 as 主营业务收入同月比增减, t.C01Uzyywsrje3 as 主营业务收入累计, t.C01Ujzzzsxse4 as 计征增值税同期比增减 from T_sscwzb t T_qyjbxx a D_xzqh c D_sshy d D_qyjjlx e Where instr(c.db_bhc,District)<>0 and (instr(e.db_dmc,BelongStyle)<>0) and (d.db_ssdl=Vocation or substr(d.dbsshy,1,length(Vocation))=Vocation) and (to_char(a.zcrq,'yyyy') <= to_char(dtDate,'yyyy')) and (to_char(a.zcrq,'yyyy') >= to_char(add_months(dtDate,-12),'yyyy')); );
create procedure jasas is begin select * from T_sscwzb; end; 创建的过程带有编译错误。
select
(
c1,c2,c3
from
table2
where
...
)
is
begin
create TEMPORARY table QueryTmp2(
日期 date,
主营业务收入本期 number null,
主营业务收入同月比增减 number null,
主营业务收入累计 number null,
计征增值税同期比增减 number null
)on commit preserve rows;;
while dtDate<=dtDate2 loopinsert into QueryTmp2(
select dtDate,
t.C01Uzyywsrje1 as 主营业务收入本期,
t.C01Uzyywsrje2 as 主营业务收入同月比增减,
t.C01Uzyywsrje3 as 主营业务收入累计,
t.C01Ujzzzsxse4 as 计征增值税同期比增减
from T_sscwzb t
T_qyjbxx a
D_xzqh c
D_sshy d
D_qyjjlx e
Where
instr(c.db_bhc,District)<>0
and (instr(e.db_dmc,BelongStyle)<>0)
and (d.db_ssdl=Vocation or substr(d.dbsshy,1,length(Vocation))=Vocation)
and (to_char(a.zcrq,'yyyy') <= to_char(dtDate,'yyyy')) and (to_char(a.zcrq,'yyyy') >= to_char(add_months(dtDate,-12),'yyyy'));
);
end loop;
end;
select dtDate,
t.C01Uzyywsrje1 as 主营业务收入本期,
t.C01Uzyywsrje2 as 主营业务收入同月比增减,
t.C01Uzyywsrje3 as 主营业务收入累计,
t.C01Ujzzzsxse4 as 计征增值税同期比增减
from T_sscwzb t
T_qyjbxx a
D_xzqh c
D_sshy d
D_qyjjlx e
Where
instr(c.db_bhc,District)<>0
and (instr(e.db_dmc,BelongStyle)<>0)
and (d.db_ssdl=Vocation or substr(d.dbsshy,1,length(Vocation))=Vocation)
and (to_char(a.zcrq,'yyyy') <= to_char(dtDate,'yyyy')) and (to_char(a.zcrq,'yyyy') >= to_char(add_months(dtDate,-12),'yyyy'));
);
is
begin
select * from T_sscwzb;
end;
创建的过程带有编译错误。