Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to check for insert query?

 
duhit Choudhary
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am very new in this topic. through my java code i m trying to execute an insert query and along with this i want to check that the value i am inserting will not get repeat. i.e it will not appear in the table if it is already there and if not then insert the value. this very perplexing for me.
it would be easy and great if somebody explain me through a program. thanks a ton.
 
Wendy Gibbons
Bartender
Posts: 1110
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you heard of database indexes?
if the insert statement is quite simple you could use indexes to prevent duplicate rows, and handle any exceptions.

or you could do a
and if any rows are returned it already exists, i would combine this witha unique index to improve performance.

Notice i am only returning the number 1, this is just to save data being transfered from the db to the java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic