针对yddw表的每一个YDDWSYH索引号 需要在另外一个表插入5条数据 对应sql是 --地均税收 insert into GYYD_PGXJG t select yddwsyh,00,00, case when djss>32 then 40 when 20<djss and djss<=32 then 30 when 10<djss and djss<=20 then 24 when 5<djss and djss<=10 then 16 when 5>=djss then 8 else 999 end,sys_guid() from yddw where yddwsyh='321112000093'; --地均营业收入 insert into GYYD_PGXJG t select yddwsyh,00,01, case when djsr>100 then 20 when 75<djsr and djsr<=100 then 16 when 50<djsr and djsr<=75 then 12 when 25<djsr and djsr<=5 then 8 when 5>=djsr then 4 else 999 end,sys_guid() from yddw where yddwsyh='321112000093'; --地均从业人员 insert into GYYD_PGXJG t select yddwsyh,00,02, case when djcyry>800 then 20 when 350<djcyry and djcyry<=800 then 16 when 156<djcyry and djcyry<=350 then 12 when 128<djcyry and djcyry<=156 then 8 when 128>=djcyry then 4 else 999 end,sys_guid() from yddw where yddwsyh='321112000093'; --人均上交税金 insert into GYYD_PGXJG t select yddwsyh,00,03, case when (case when CYRY=0 then 0 else nvl(ROUND(SJSJ/CYRY,2),0.0) end )>200 then 10 when 100<(case when CYRY=0 then 0 else nvl(ROUND(SJSJ/CYRY,2),0.0) end ) and (case when CYRY=0 then 0 else nvl(ROUND(SJSJ/CYRY,2),0.0) end )<=200 then 8 when 50<(case when CYRY=0 then 0 else nvl(ROUND(SJSJ/CYRY,2),0.0) end ) and (case when CYRY=0 then 0 else nvl(ROUND(SJSJ/CYRY,2),0.0) end )<=100 then 6 when 10<(case when CYRY=0 then 0 else nvl(ROUND(SJSJ/CYRY,2),0.0) end ) and (case when CYRY=0 then 0 else nvl(ROUND(SJSj/CYRY,2),0.0) end )<=50 then 4 when 10>=(case when CYRY=0 then 0 else nvl(ROUND(SJSJ/CYRY,2),0.0) end ) then 2 else 999 end,sys_guid() from yddw where yddwsyh='321112000093'; --人均营业收入 insert into GYYD_PGXJG t select yddwsyh,00,04, case when (case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end )>200 then 10 when 100<(case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end ) and (case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end )<=200 then 8 when 50<(case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end ) and (case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end )<=100 then 6 when 15<(case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end ) and (case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end )<=50 then 4 when 15>=(case when CYRY=0 then 0 else nvl(ROUND(YYSR/CYRY,2),0.0) end ) then 2 else 999 end,sys_guid() from yddw where yddwsyh='321112000093'; 但是yddw表的yddwsyh 有30万条。怎么能快速插入啊 |