Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 647969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:46:53+00:00 2026-05-13T21:46:53+00:00

Of late, I have a tendency to validate my stored procedure action query arguments

  • 0

Of late, I have a tendency to validate my stored procedure action query arguments before actually performing the query. An example would be to check that, on update to table ‘T’ that has a column ‘C’ which has a unique index, that the Update would not fail… by first performing a “Select Exists on the unique index” type of query before the actual Update. If the unique index would be violated I am therefore trapping the error early and returning.

I have basically built on my usual optimistic locking strategy of examining that the record I am updating is still eligible for update i.e. hasn’t changed. I have taken it a step further by testing that the unique index would not be violated if I were to perform the Update.

The thing is, I’ve only recently started doing this and I can’t decide if it’s the right thing to do or I should just let the Update handle the unique index failure.

Does anyone have any sound advice in this area?

I’m also interested in other people’s approaches to parameter validation in general.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:46:53+00:00Added an answer on May 13, 2026 at 9:46 pm

    It seems like a lot of unnecessary work for me.

    Also, assuming you’re just changing the return value, you’re taking what would normally be an exception and turning it into a stored procedure that returns a different value. This could lead to logic errors, which are harder to track.

    Added

    The other thought I had on this is that you may be catching errors at the DB level that should be caught (or at least could be caught more gracefully) at the Business Logic or UI level.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's late and I have written this monstrosity of a query to get related
It's too late to change the question, but more precise would have been to
Simplified example: I have a to-do. It can be future, current, or late based
I have a hopefully simple MySQL query question which is eluding me at late
I'm originally a C# developer (as a hobby), but as of late I have
It's probably late and I have missed this off by a long shot. I
I have been tearing my hair out of late trying to get my web
I have a page with multiple DevExpress gridviews which are late-loaded via ajax. The
If you have the e-mail address you.late.you@asdf.com you_late_you@asdf.com How are you enable to count
it's late, I'm tired, and probably being quite dense.... I have written an application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.