Please excuse my ignorance. I am learning as I go.
I am updating a program to combine like rows and I created a cusor and then want to loop back through and the rows back to the table after deleting the originals.
My Foreach statment is getting this error. I commented eveything out and added it back one by one to isolate where the error was occuring but I cant see the problem.
declare get_dists2 cursor for
select * into ED2.* , holdZZ.* from hr_earndist, hr_emppay
where exists (select ed.account, ed.gl_key, ed.gl_ledger, ed.gl_obj, ed.jl_key, ed.jl_ledger, ed.jl_obj, ed.lock_flag, ed.misc, ed.over_budg, ed.over_code, sum (ed.percent), ed.prime_flag, min(ed.unique_key),ed.uniqueid
from hr_earndist ed, hr_emppay ep
where ed.uniqueid = ep.uniqueid
and ep.reas_cd = '04'
and b.pay_beg <= targetDATE
and b.pay_end >= targetDATE
group by ed.gl_key, ed.gl_ledger, ed.gl_obj, ed.jl_key, ed.jl_ledger,ed.jl_obj, ed.account, ed.lock_flag, ed.misc, ed.over_budg,ed.over_code, ed.prime_flag, ep.uniqueid)
<deletes>
FOREACH get_dists2
let RECcnt2 = RECcnt2 + 1
let ED2.uniqueid = initEP.uniqueid
if RECcnt2 > 0 and RECcnt2 < 37 and ED2.percent <> 0 then
insert into hr_earndist values (ED2.*)
end if
END FOREACH
I am updating a program to combine like rows and I created a cusor and then want to loop back through and the rows back to the table after deleting the originals.
My Foreach statment is getting this error. I commented eveything out and added it back one by one to isolate where the error was occuring but I cant see the problem.
declare get_dists2 cursor for
select * into ED2.* , holdZZ.* from hr_earndist, hr_emppay
where exists (select ed.account, ed.gl_key, ed.gl_ledger, ed.gl_obj, ed.jl_key, ed.jl_ledger, ed.jl_obj, ed.lock_flag, ed.misc, ed.over_budg, ed.over_code, sum (ed.percent), ed.prime_flag, min(ed.unique_key),ed.uniqueid
from hr_earndist ed, hr_emppay ep
where ed.uniqueid = ep.uniqueid
and ep.reas_cd = '04'
and b.pay_beg <= targetDATE
and b.pay_end >= targetDATE
group by ed.gl_key, ed.gl_ledger, ed.gl_obj, ed.jl_key, ed.jl_ledger,ed.jl_obj, ed.account, ed.lock_flag, ed.misc, ed.over_budg,ed.over_code, ed.prime_flag, ep.uniqueid)
<deletes>
FOREACH get_dists2
let RECcnt2 = RECcnt2 + 1
let ED2.uniqueid = initEP.uniqueid
if RECcnt2 > 0 and RECcnt2 < 37 and ED2.percent <> 0 then
insert into hr_earndist values (ED2.*)
end if
END FOREACH