От: | Funny Rabbit | ||
Дата: | 31.10.19 05:26 | ||
Оценка: |
select extract(month from v.ddate_from),
extract(year from v.ddate_from),
extract(month from v.ddate_to),
extract(year from v.ddate_to)
into dmonth1, dyear1, dmonth2, dyear2
from T1 v
where v.NPRN = r.nrn;
select sum(vpd.nsumm)
into dbo
from T2 vpd
where vpd.nprn = user_num
and vpd.nyear between dyear1 and dyear2
and vpd.nmonth between dmonth1 and dmonth2;