Можно сделать данной процедурой create or replace procedure P_COPY_USERDATA2 (sUSERID in varchar2, sUSERID2 in varchar2, nCOMPANY in number) is
cursor c1 is
select d.authid1,
d.appcode,
d.data,
d.sequence,
d.seqsize
from userdata d
where d.authid = sUSERID and
d.company = nCOMPANY;
dat c1%rowtype;
begin
delete userdata where authid = sUSERID2 and company = nCOMPANY;
open c1;
loop
fetch c1 into dat;
exit when c1%notfound;
insert into userdata
(rn,
company,
authid,
authid1,
appcode,
data,
sequence,
seqsize)
values
(gen_id,
nCOMPANY,
sUSERID2,
dat.authid1,
dat.appcode,
dat.data,
dat.sequence,
dat.seqsize);
commit;
end loop;
close c1;
end;
nCOMPANY - к организации, sUSERID - пользователь источник, sUSERID2 - пользователь приёмник
|