Duplicate Record [message #626057] |
Mon, 20 October 2014 04:24 |
|
glmjoy
Messages: 187 Registered: September 2011 Location: KR
|
Senior Member |
|
|
Create Table ABC(B_No Char(10);
Insert into ABC('AAAAAAAAAAA');
Insert into ABC('BBBBBBBBBBB');
Insert into ABC('CCCCCCCCCCC');
On form level I want to stop Duplicate Value and will give message of Duplicate Record
if some one insert again the above record it will give message.
AAAAAAAAAAA
AAAAAAAAAAA
BBBBBBBBBBB
CCCCCCCCCCC
On Validate Item I have made trigger but its not working.
declare
cBL_Number char(30);
begin
select count(*)
into cBl_Number
from Igm_Header;
--where Bl_Number= cBl_Number ;
if cBl_Number>1 then
message('Duplicate ');
message('Duplicate ');
end if;
end;
I dont know where i am mistaking.
Thanks in Advance
[Updated on: Mon, 20 October 2014 04:36] Report message to a moderator
|
|
|
Re: Duplicate Record [message #626060 is a reply to message #626057] |
Mon, 20 October 2014 04:37 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
1) Please read and follow How to use [code] tags and make your code easier to read? - I'm sure you've been asked before.
2) If you're going to change object names before posting, do it consistently or don't bother. The names in your code aren't same as the names in the create table statement.
3) The where clause you've commented out is obviously wrong - you need to restrict the query with the form item you're checking, not a local variable with no value.
4) Message will not prevent the user from saving the duplicate record - you need to use raise form_trigger_failure.
5) For this approach to work you must ensure each new record is added to the DB before another is entered - using either post or commit.
|
|
|
|
Re: Duplicate Record [message #626151 is a reply to message #626096] |
Tue, 21 October 2014 10:23 |
|
mughals_king
Messages: 392 Registered: January 2012 Location: pakistan
|
Senior Member |
|
|
have you solved your problem @Craig is right this is very comman question anywayz i have had already provided solution on this forum regarding related to your question if you need i can upload .FMB file.
Regard
Mughal
[Updated on: Tue, 21 October 2014 10:25] Report message to a moderator
|
|
|
|