|
|
|
Re: how to preven user from iserting duplicate records into tabular form [message #201107 is a reply to message #200972] |
Thu, 02 November 2006 10:02 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
yogen
Messages: 39 Registered: October 2006 Location: UK
|
Member |
|
|
First thing you need to have primary or uniq key on your base table.
then one solution of your problem is that you can set DML set to 1 so that user can insert or update only one record at a time.
second you can use record groups and use when-validate-record trigger to insert the uniq key into record group and check newly inserted record against this record group.(i have never implemeted this but it should work)
and to make it more easy you can use a oracle table in place of record group .
e.g.
create a similar table like your base table.
in when-validate-record
just check
select count(*) into :v_count
from my_temp_table t1
where :blk.col1= t1.col1
....
all cols which are part of primary key....
and similar query on tha base table also
then if v_count is 0 then
insert into my_temp_table values(:blk.col1,blk.col2....)
something like this should fix your problem.
[Updated on: Thu, 02 November 2006 10:11] Report message to a moderator
|
|
|
|
|
|
|
|