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 7436379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:13:48+00:00 2026-05-29T10:13:48+00:00

I am somewhat new to writing sql, and I know I can write a

  • 0

I am somewhat new to writing sql, and I know I can write a stored procedure with optional parameters. How can I specify optional parameters, but enforce that at least one optional parameter is required. Is this possible?

I want to be able to use the stored procedure to insert a row into a log table where there are a number of type flags to show what kind of entry it is. Therefore at least one of the flags should be set to true(1).

  • 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-29T10:13:48+00:00Added an answer on May 29, 2026 at 10:13 am

    I think the best approach in this case is to define only one parameter, for example an ENUM type, witch will represent “witch of the flags has to be set to true”. It will not be an optionnal parameter, because at least one of your flags has to be set to true.
    Flags columns in your log table have to be DEFAULT false or DEFAULT NULL.

    You will use an IF statement in the procedure to set the appropriate flag to 1 in your inserted log values (you should declare a temporary variable for each flag and set the appropriate flag to 1).

    (Additionnaly, if you want to constraint your log entries to have at least one flag to 1, you can write a before insert and a before update trigger.)

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

Sidebar

Related Questions

I'm somewhat new to SQL and need help with query syntax. My issue involves
I'm somewhat new to Swing programming, and I find that as much as I
I'm somewhat new to writing tests. I've find myself struggling with keeping my setUp's
Hey. I'm somewhat new to Objective-C (for Mac, this is) and I'm writing an
So I am still somewhat new to PHP, MySQL, and Javascript but I have
I'm somewhat new to MVC (but not ASP.NET). Is there a similar concept in
I'm somewhat new to regular expressions and am writing validation for a quantity field
I am somewhat new to PL/SQL, and am having a little trouble using a
I will preface the question by saying that I am somewhat new to the
I'm somewhat new to the ASP.NET MVC architecture and I'm trying to sort out

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.