Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re: Checking for duplicate rows

 
Ashwin Tadepalli
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What is the easiest way to check for the insertion of duplicate rows in a database table from a client program.I have tried used using try catch block statements and then raising an exception,but it does not solve my problem.All of my JDBC processing is done through a servlet,so if I try to run the client program and try to insert some duplicate entries it stops my servlet engine.I can see that it has raised that SQL exception on the console of my Visual Age tool,but I want some other method which will not let my servlet engine to stop but tell in advance to the client program(on the command prompt) that you are trying to insert some duplicate entries.Any suggestions on this topic are welcome.
Thanking You
Ashwin
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the kiss() method...
exec a select using the table's primary key...
if you get a row count GT 0..
then you have a duplicate...

------------------
Multi-Platform Database Developer
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic