Update by cursor [message #80494] |
Tue, 01 October 2002 22:22 |
Shofi
Messages: 3 Registered: October 2002
|
Junior Member |
|
|
Hi Friends,
I have written a cursor for updating a table from some tables by pressing a Push Button/when button press. But it is taking always the first records for all rows. I have given the code below. Could anybody help me?
declare
cursor upe
is
select employee_payment.id im,allowance.id ia,allowance.shoe sh,allowance.fasting fa,
allowance.bonus bu,allowance.eidgratia ei, overtimeal.id io, overtimeal.total ot,
nightal.id ig,nightal.total nt from employee_payment,overtimeal,nightal,
allowance where :employee_payment.id=allowance.id and :employee_payment.id=overtimeal.id
and :employee_payment.id=nightal.id;
al upe%rowtype;
begin
open upe;
loop
fetch upe into al;
exit when upe%notfound;
update employee_payment
set totalallowance =al.sh+al.fa+al.bu+al.ei+al.ot+al.nt
where al.im=al.ia and al.im=al.io and al.im=al.ig;
end loop;
close upe;
end;
|
|
|
|