Home » Developer & Programmer » Forms » duplicacy in records occuring
duplicacy in records occuring [message #418932] Wed, 19 August 2009 04:08 Go to next message
simcky
Messages: 38
Registered: July 2009
Member
hi i m writting this when-button-pressed trigger

begin
delete from prmamed
where empno=:prmamed.empno
and earningdeduction=:prmamed.earningdeduction;
go_block('prmamed2');
first_record;
LOOP
INSERT INTO PRMAMED(EMPNO,EARNINGDEDUCTION,PAYPERIOD,REFNO,AMT,REFDATE)
VALUES (:prmaMED2.EMPNO,:prmaMED2.EARNINGDEDUCTION,:PRMAMED2.PAYPERIOD,:PRMAMED2.REFNO,:PRMAMED2.AMT,:PRMAMED2.REFDATE);
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE' ;
END LOOP;
NEXT_RECORD;
clear_form(do_commit);
END;

it's work is to delete the previous records and insert the new one it's working but the problem is that duplicacy of records is occuring at backend pls help me out to remove the duplicacy

[Updated on: Wed, 19 August 2009 04:14]

Report message to a moderator

Re: duplicacy in records occuring [message #418938 is a reply to message #418932] Wed, 19 August 2009 04:35 Go to previous messageGo to next message
kame
Messages: 69
Registered: July 2009
Member
use commit
before
go_block

delete from prmamed
where empno=:prmamed.empno
and earningdeduction=:prmamed.earningdeduction;
commit;
go_block('prmamed2');
Re: duplicacy in records occuring [message #418939 is a reply to message #418932] Wed, 19 August 2009 04:50 Go to previous messageGo to next message
cookiemonster
Messages: 12422
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) Can you please use code tags - see the orafaq forum guide if you don't know how.
2) That loop is either going to insert 1 row or an infinite number rows - the next_record is in the wrong place.

@kame - I doubt an extra commit is going to make any difference.
Re: duplicacy in records occuring [message #418962 is a reply to message #418939] Wed, 19 August 2009 06:18 Go to previous message
simcky
Messages: 38
Registered: July 2009
Member
thanks to kate and cookiemonster by applying both of your suggestions my trigger is working properly now thanks a lot 2 both of u. Smile
Previous Topic: use substr & instr to create form
Next Topic: Could anyone please help with a quick design question?
Goto Forum:
  


Current Time: Fri Dec 09 05:40:38 CST 2016

Total time taken to generate the page: 0.22020 seconds