PL/SQL Case question,
simple example from the web:
But what if have want to combine expression1 and expression 2 to give me the same result?
My CASE cannot have BETWEEN because it is either 1 or 3 or 7.
I tried:
and I tried:
That all have me en error (Missing keyword)
I know I can do:
But this way I would repeat [tt]result1[/tt], but that's ugly coding. :-(
I cannot find the example of combining several expressions in CASE WHEN statement, that should be possible
Have fun.
---- Andy
simple example from the web:
Code:
CASE search_expression
WHEN expression1 THEN result1
WHEN expression2 THEN result2
...
WHEN expressionN THEN resultN
ELSE default_result
END
But what if have want to combine expression1 and expression 2 to give me the same result?
Code:
CASE some_number
WHEN 1, 3, 7 THEN result1
WHEN 2 THEN result2
...
END
My CASE cannot have BETWEEN because it is either 1 or 3 or 7.
I tried:
Code:
CASE some_number
WHEN 1 OR 3 OR 7 THEN result1
WHEN 2 THEN result2
...
END
and I tried:
Code:
CASE some_number
WHEN some_number = 1 OR some_number = 3 OR some_number = 7 THEN result1
WHEN 2 THEN result2
...
END
That all have me en error (Missing keyword)
I know I can do:
Code:
CASE some_number
WHEN 1 THEN result1
WHEN 3 THEN result1
WHEN 7 THEN result1
WHEN 2 THEN result2
...
END
But this way I would repeat [tt]result1[/tt], but that's ugly coding. :-(
I cannot find the example of combining several expressions in CASE WHEN statement, that should be possible
Have fun.
---- Andy