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

exception

 
Tmmet Johnson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a question.I am using Oracle database.
I want to insert a record into a table.If the record already exists,I want to throw an exception.
I am not checking whether the record exists or not,before inserting into the database.
My questions are
1.What exception will be thrown if I try to insert a record that already exists in the database?That exception is present in which jar?

Is there any other way to handle the above scenario without first checking whether the recrod exists or not.

Thanks in advance,
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think most likely an SQLException will be thrown. It is in the java.sql package.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our JDBC forum.
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic