I have a stored procedure in which a field [sic] is being returned as Yes or No [sic] based upon a column in a table using CASE statement [sic]. now I need to add another condition to retrieve the field [sic]. below is the condition.
Please read a book on SQL.
The term field means part of a temporal value {YEAR, MONTH, DAY, HOUR, MINUTE, SECOND}. I think that you meant column instead.
CASE is an expression, not a statement. This I not just SQL! This is a fundamental programming concept.
Too bad we cannot see the code. But I guess you have magic powers and can programming without seeing code.
>> If a particular input parameter is 1, I need to retain the existing condition itself. If the same input parameter is 2, I need to return yes or no based upon another date column in a different table. <<
Another fundamental programming concept error. A parameter is a formal marker in the procedure declaration. A specific value assigned to a parameter on invocation is an
argument.
Finally, we do not use flags in SQL or other languages. If you had taken a course or read a single book on Software Engineering, you would know about
coupling and cohesion.
Ideally, a module of code in any language performs one and only one clearly defined task, not matter where it is invoked; this is called functional cohesion (think of a mathematical function as the best example). But your incoherent code depends on a flag to
determine the task to be done. It might be automobiles, it might be squids, it might be Lady GaGa! You will find out at invocation! The environment determines what the code does! Magic!
If you had followed forum netiquette, we could help you. Want to try again?
You obviously never did any real programming before, and it is hard to get the basics the first few months. And SQL was a bad place to start learning (most of us begin with procedural rather than declarative languages). Stick with it and you get it in a
few years.