Hi Chuck -

On Fri, 19 Oct 2012 00:18:45 -0500, CRPence <CRPbottle@xxxxxxxxx>
wrote:

That is, consider this scenario: Is the key I am about to insert
already there? Lookup the key value. Not found, so let's insert.
Argh! Duplicate key error on the write!

Thus since the code likely needs to handle the duplicate key error
irrespective of this advance lookup having been coded to ensure the key
value does not exist, then how much value was there in checking first in
the application? Is it purely overhead? Perhaps just perform the
insert and handle the exception only if\when it occurs.?

I prefer to check first, and then also handle it on write, so as to
avoid error messages in the job log except in the rare circumstance
where some other job adds the record inbetween this job's check and
write.

Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.




Return to Archive home page | Return to MIDRANGE.COM home page