0

再次出现一个令人发指的错误..

不是单组群功能

我有一个空表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;
4

1 回答 1

2

它应该通过以下方式与组一起工作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;
于 2013-02-15T11:30:00.637 回答