If the tables are under your control, there is no need to perform additional validation. Just suppose they are configured correctly and let SQL handle any error. Constantly checking that you really did what you intended to do is overly protective programming that adds unnecessary complexity to your code.
For example, you will not write code like this:
i = 1; if (i != 1) { print "Error: i is not 1!"; }
And I see this situation as similar.
If the tables are not under your control, it may be useful to handle the error gracefully. For example, if this procedure can be performed on an arbitrary set of tables created by the user, or if it will be distributed to external users who need to set up tables in their own database, you might want to add some custom error handling. The purpose of this would be to give the user a clearer description of what went wrong.
user1919238
source share