oracle for 在 sql developer 中循环
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14893471/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:27:18 来源:igfitidea点击:
for looping in sql developer
提问by user2074685
Again there is a outrageously freaking error..
再次出现了一个令人发指的错误..
not a single-group group function
不是单组组功能
I have got an empty table mig_temp1
, which I want to fill with observations))
what is wrong about this select??
我有一个空表mig_temp1
,我想用观察值填充它))这个选择有什么问题??
begin
for j in 1..7 loop
for t in 0..32 loop
insert into mig_temp1 (report_date, portfolio, bucket, Q)
select add_months(to_date('31.10.2014','DD.MM.YYYY'),-t),
cp.portfolio, j, count(*)
from proba_cft pr, credtoportfolio cp
where pr.credit_num = cp.credit and pr.dpd_47 between 30*(j-1)+1 and 30*j;
end loop;
end loop;
end;
回答by DazzaL
it should work with a group by on cp.portfolio
:
它应该与一个小组合作cp.portfolio
:
begin
for j in 1..7 loop
for t in 0..32 loop
insert into mig_temp1 (report_date, portfolio, bucket, Q)
select add_months(to_date('31.10.2014','DD.MM.YYYY'),-t),
cp.portfolio, j, count(*)
from proba_cft pr, credtoportfolio cp
where pr.credit_num = cp.credit and pr.dpd_47 between 30*(j-1)+1 and 30*j
group by cp.portfolio;
end loop;
end loop;
end;