Home » Developer & Programmer » Forms » Preventing duplicate records in form without saving the record
Preventing duplicate records in form without saving the record [message #159882] Wed, 22 February 2006 01:38 Go to next message
v1i9kash
Messages: 5
Registered: April 2005
Junior Member
hi,
I hv some prblem like...

Create table abc(
Roll_no number(3),
Name varchar2(30));

There is no validation/constraint on table.
From form a user wants to inter 10 consequtive record without saving the record at each time he intered the record.What is the logic for preventing duplicate records at entry time.User saves the records after 10records, he entered.
Re: Preventing duplicate records in form without saving the record [message #159897 is a reply to message #159882] Wed, 22 February 2006 02:39 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Why don't you have primary / unique key enabled? If you had it, Oracle would take care about duplicate records; whatever you do, writing some kind of a trigger, would be an unnecessary overhead.

Besides that, what does it mean, a "duplicate record"? What is duplicate? All fields that make a record or only some of them?
Re: Preventing duplicate records in form without saving the record [message #159935 is a reply to message #159882] Wed, 22 February 2006 05:24 Go to previous messageGo to next message
samidc
Messages: 35
Registered: February 2006
Member
There are two options.

1) In a pre-insert trigger select count for that value . if value exists then raise form trigger failure and pop up message that Duplicate value exists
else
insert_record.

2) Second option is set property of item ( the one which you not want to be as a duplicate) as a primary key .

Thanks
SaMiR
Re: Preventing duplicate records in form without saving the record [message #160027 is a reply to message #159935] Wed, 22 February 2006 16:19 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
When this question was raised previously the 'group wisdom' was to populate a record group with the list of keys, then when you enter a record you test against the record group. If it exists scream, if not, then accept the record and add the key to the list. If you delete a record you remove the key from the record group and delete the record.

David
Re: Preventing duplicate records in form without saving the record [message #160043 is a reply to message #159897] Wed, 22 February 2006 23:30 Go to previous messageGo to next message
v1i9kash
Messages: 5
Registered: April 2005
Junior Member
here record is not saved one by one.user inter Record & click next button. like as for Roll_no user inter 101,102,103...if he inters 101 again then message the user for duplicate roll_no.
Re: Preventing duplicate records in form without saving the record [message #160044 is a reply to message #160043] Wed, 22 February 2006 23:39 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Yes, the records are NOT saved one by one, but the records ARE entered one by one. You do the record group stuff in the When-Valdiate-Item trigger which will fire record by record as you enter or change them.

David
Previous Topic: how to connect to form builder
Next Topic: forms 9i questions
Goto Forum:
  


Current Time: Fri Sep 20 04:54:52 CDT 2024