|
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
|