Home » Developer & Programmer » Forms » how to validate primary key fields in forms 6i (forms 6i,win XP)
how to validate primary key fields in forms 6i [message #497373] Sat, 05 March 2011 01:16 Go to next message
maddyd2k
Messages: 24
Registered: November 2010
Junior Member
i have a emp block with multiple rows in which col1,col2,col3,col4,col5,col6 are the columns
In emp block col1,col2,col3 are the primary key fields..
i need to validate the primary key columns such that it should not allow duplicates values in the primary key col's with out checking the database values...with out using enforce primary key property

how can i achieve this???

thanks
Re: how to validate primary key fields in forms 6i [message #497419 is a reply to message #497373] Sat, 05 March 2011 08:09 Go to previous messageGo to next message
ranamirfan
Messages: 535
Registered: January 2006
Location: Pakistan / Saudi Arabia
Senior Member

Dear,

As a Sample code pls try this.

WHEN-VALIDATE-RECORD at Block level (Emp).
Declare
N Number;
Begin
Select count(*)   Into N from Emp_Table 
where Col1=:Emp.Col1
and   Col2=:Emp.Col2
and   Col3=:emp.Col3;

If Nvl(N,0)>0 then
message('Duplicate Value Exist !');
message('Duplicate Value Exist !');
Raise Form_Trigger_Failure;
End if;

End;




Hope It'll Help You.

Regards,
Irfan
Re: how to validate primary key fields in forms 6i [message #497424 is a reply to message #497419] Sat, 05 March 2011 08:46 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Your code, Irfan, will check existing values. But, it won't prevent user to enter as many duplicates as he/she wants into the form (because those records don't exist in a table (yet)). However: if you add POST in there, that would be something different.

Maddy: why don't you want to use Forms built-in functionalities?
Previous Topic: Oracle forms 4.5 | Up-gradation to 11i Vs Upgrade to totally different technology like Web based etc
Next Topic: Fingerprint Device Connectivity with Forms 10g
Goto Forum:
  


Current Time: Mon Sep 16 13:05:49 CDT 2024