Friday, August 05, 2005

An "A" for creativity ... but ...

I came across a new article over at CodeProject, and I couldn’t help myself.  In a nutshell, the author was trying to solve the following problem:  How can I get rid of those irritating ORA-xxxx errors that are thrown when I attempt to INSERT records into the database and the field data violates a key constraint?

I’m all for creative, “out-of-the-box” thinking … but the solution proposed (which would word) is a heck of a lot more work than necessary:  by storing additional information in the database that you check against before you attempt to insert the data.  Not necessary, as you can use those ORA-errors to help you get the job done:  Trap the errors in a PL/SQL exception block and deal with them inside the database.  No additional tables, no additional tests, better scalability.

At any rate, if you’re interested, check out the article.