Subject | Joining to selectable stored procedure |
---|---|
Author | Rick Debay |
Post date | 2006-09-11T22:21:18Z |
This query returns 'no current record for fetch operation'.
select
rg.ID,
sum(p.ppu * p.to_buy * (case when p.multisrc='Y' then
rg.buyout_mult_gener else rg.buyout_mult_brand end))
from
CRM_RPL_GRP rg
join P_GET_BUYOUT_ITEMS(current_date,rg.ID,'N') p
on 1=1
where
rg.ID = '01Q'
group by
rg.ID
This version works, but I'd need to run it once for every line in
CRM_RPL_GRP. Is the above SQL correct?
select
rg.ID,
sum(p.ppu * p.to_buy * (case when p.multisrc='Y' then
rg.buyout_mult_gener else rg.buyout_mult_brand end))
from
P_GET_BUYOUT_ITEMS (current_date,'01Q','N') p
join CRM_RPL_GRP rg
on rg.ID = '01Q'
select
rg.ID,
sum(p.ppu * p.to_buy * (case when p.multisrc='Y' then
rg.buyout_mult_gener else rg.buyout_mult_brand end))
from
CRM_RPL_GRP rg
join P_GET_BUYOUT_ITEMS(current_date,rg.ID,'N') p
on 1=1
where
rg.ID = '01Q'
group by
rg.ID
This version works, but I'd need to run it once for every line in
CRM_RPL_GRP. Is the above SQL correct?
select
rg.ID,
sum(p.ppu * p.to_buy * (case when p.multisrc='Y' then
rg.buyout_mult_gener else rg.buyout_mult_brand end))
from
P_GET_BUYOUT_ITEMS (current_date,'01Q','N') p
join CRM_RPL_GRP rg
on rg.ID = '01Q'