|
|
|
|
Re: how to check duplicate values in a grid (details) data block [message #87547 is a reply to message #87519] |
Fri, 14 January 2005 01:45   |
oralover
Messages: 97 Registered: January 2005
|
Member |
|
|
try this, you can check duplicates without saving in database.
FUNCTION chk_the_duplicate(your_field data_type, rec_no number) RETURN CHAR IS
total_records number:=0;
ret_val varchar2(1):='0';
BEGIN
last_record;
total_records:=to_number(:system.cursor_record);
first_record;
for i in 1..total_records loop
if to_number(:system.cursor_record) != rec_no then
if :BLOCK_NAME.your_unique_field = your_field then
ret_val := '1'; -- this will indicate that Duplicate found
exit;
end if;
end if;
if to_number(:system.cursor_record) = total_records then
exit;
else
next_record;
end if;
end loop;
return(ret_val);
END;
|
|
|
|