|
|
|
Re: How to restrict user not to enter duplicate Record? [message #633545 is a reply to message #633544] |
Sat, 21 February 2015 00:30 |
|
jgjeetu
Messages: 373 Registered: July 2013 Location: www.Orafaq.com/Forum
|
Senior Member |
|
|
Try to find out the count of records on the basis of new input and check there values in column wheather they are already existing or not .
for ex. there are 3 columns in a row.
column 1 has value A, Column 2 has value B, Column 3 has value C.
and user entered A in column 1 , B in column 2 , C in column 3 . then in that case he will not be able to save the record else he will be able to.
you can use count function here to prevent the duplicacy of record.
Quote:I think you haven't studied my attached Picture.
& One more thing You are not paying anyone here to help you , so if someone is trying to help you then you are supposed to respect him/her & Most Imp the senior members definitely.
Thanks.
[Updated on: Sat, 21 February 2015 00:39] Report message to a moderator
|
|
|
|
|
|
Re: How to restrict user not to enter duplicate Record? [message #633598 is a reply to message #633562] |
Mon, 23 February 2015 00:52 |
|
Hello jgjeetu & littlefoot,
First of all I apologize for using of Harsh words in my sentences. Moreover, I will be thankful to all of you who are helping me in the matter.
Same like invoice at General Store each item must be entered at once and quantity may be varied. Same issue is here I would like to restrict the user not to enter multiple accounts in the same voucher.
Keeping in view the littlefoot suggestion the use of unique key is not possible as it will restrict the user not to enter account no (accno) as it is already Exists in database. But the invoice in new so the solution may not working.
I would like to restrict the user at Form Level that if the account no is already entered in detail then multiple entries in the same may not be allowed.
Regards,
Usman
|
|
|
Re: How to restrict user not to enter duplicate Record? [message #633599 is a reply to message #633598] |
Mon, 23 February 2015 01:04 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Unique index doesn't have to be restricted to only one column - it can be a composite index, which consists of more columns. One of these would be a foreign key column, another one would be ACCNO from the details table. Something like this:
create table master
(id_master number constraint pk_master primary key,
some_column varchar2(20),
...
);
create table detail
(id_detail number constraint pk_detail primary key,
id_master number constraint fk_det_mas references master(id_master),
accno number not null,
some_column varchar2(10),
...
);
I think that you think that unique index must look like this:
create unique index ui1_detail on detail (accno); and you are worried that you won't even be able to create one, as duplicates already exist. That's OK, no problem.
That's why you have to (and can) create a composite index, such as
create unique index ui1_detail on detail (id_master, accno);
Got it?
|
|
|
|
|
|
|