Problem solve Get help with specific problems with your technologies, process and projects.

Perform a check or wait for an error?

Is always performing a select statement check before executing the Insert/Update/Delete statements through JDBC a good approach, as opposed to waiting for Oracle to report back an error?

There are differing opinions on which is the best approach, but I prefer trapping errors to SELECTing first. The reason is that if you SELECT first and find that you will do your Insert/Update/Delete statement, you've just doubled the work your program has to do. If you SELECT first and then find that you will go ahead and do the actual statement, you will be doing two I/O's (in effect). If you just do the DML and it fails, you've only done one I/O....thus, it could be considered better performance to let the statement fail, trap it and deal with it that way rather than taking on the extra overhead of doing the SELECT statement.

If you don't mind the extra overhead, doing the SELECT is still an option.

For More Information

Dig Deeper on Oracle error messages

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.