I am trying to use a stored procedure to return data based on a parameter
that is passed to the procedure. I effectivly have the following 3 cases
(CurrentStatus is the parameter passed into the procedure):
CurrentStatus = "OPEN"
Select
PCMSNumber, SubSystem, Status
From
spn W
Where
Status in ('IN_REVIEW','PENDING_APPROVAL')
CurrentStatus = "CLOSED"
Select
PCMSNumber, SubSystem, Status
From
spn W
Where
Status in not in ('IN_REVIEW','PENDING_APPROVAL')
--Could changed the above to be in ('Choice 3','Choice 4')
CurrentStatus = "ALL"
Select
PCMSNumber, SubSystem, Status
From
spn W
Due to other reasons, I don't want to just repeat the query three times. Is
there some way to do something like this in a single query.