Can't check list items in Case Statement state?

I am trying to check whether a list of elements contains a specific number in the condition clause of a case statement in Oracle 10g. However, I get error ORA-00936: missing expression . I am trying to do something like the following:

 Select case 'some_column_data' when in (1,2,3) then 'do_something' else 'do_something_else' end; 

So, is there a way to accomplish what I'm going to do, or check if the value in the list iteratively in different when statements is the only solution?

+4
source share
1 answer

How about using a Searched CASE expression?

  CASE WHEN 'some_column_data' IN (1,2,3) THEN 'do_something' ELSE 'do_something_else' END 

See here and here .

+6
source

Source: https://habr.com/ru/post/1400580/


All Articles