Home » Developer & Programmer » Forms » how to check for duplicates in table (Oracle 9i)
how to check for duplicates in table [message #326454] Wed, 11 June 2008 09:55 Go to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

I am trying to check to see if a record already exist before it is inserted to a table, if it does exist I will like a message to display or highlight the record and NOT insert that record. Any suggestions on how to do this ?

I was thinking of some sort of cursor in my form and if it is found display a message, I searched the entries in the forum and found none that could help.

Any help is appreciated.
Re: how to check for duplicates in table [message #326457 is a reply to message #326454] Wed, 11 June 2008 10:03 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
deahayes3 wrote on Wed, 11 June 2008 07:55
I am trying to check to see if a record already exist before it is inserted to a table, if it does exist I will like a message to display or highlight the record and NOT insert that record. Any suggestions on how to do this ?

I was thinking of some sort of cursor in my form and if it is found display a message, I searched the entries in the forum and found none that could help.

Any help is appreciated.

add a UNIQUE index
Re: how to check for duplicates in table [message #326474 is a reply to message #326457] Wed, 11 June 2008 10:35 Go to previous messageGo to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

I have an unique index on the table, but my question is if the user tries to insert a record that already exist, i would like to display some sort of warning, how do I do that if the entry they are trying to insert coming from a form?
Re: how to check for duplicates in table [message #326475 is a reply to message #326454] Wed, 11 June 2008 10:39 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Are you saying that you don't know how to trap this error & report it back to the user?

http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above

What Operating System name & version?
Which Oracle DB version to 4 decimal places?
Which version of Forms?
Re: how to check for duplicates in table [message #326480 is a reply to message #326475] Wed, 11 June 2008 11:16 Go to previous message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

I got it, thanks. I added an exception where the insert was occurring on the form and displayed a message and changed foreground color of record that was a duplicate.

message('You have duplicate records!');

set_item_instance_property('EMPL_MASTER.EMP_FULL_NAME',current_record,VISUAL_ATTRIBUTE, 'DUPLICATE_EXIST');


Previous Topic: Pl/sql Table problem
Next Topic: Procedure Block
Goto Forum:
  


Current Time: Fri Sep 27 12:22:56 CDT 2024