Multiple return IN and CASE clause using Oracle SQL

Asked

Viewed 142 times

0

I have a situation, using an Oracle-SQL database, where depending on the value informed of a variable (YES/NO), the value being used in the query will change. I tried as below but returns the error:

ORA-00932: inconsistent data types: expected CHAR got SYS.ODCIVARCHAR2LIST

Snippet of SQL I tried to mount (instead of the first’S' goes the variable) of the past.

AND  mc.segment3             in (CASE WHEN 'S' = 'S' THEN
                                         sys.odcivarchar2list('060','071')
                                      ELSE sys.odcivarchar2list('059')
                                 END) 
  • You tried to put that in a sub-select?

  • @Brunowarmling I’m trying to think of a subselect now

  • ( (VS = ’S' AND mc.segment3 IN ('060','071') OR (VS <> ’S' AND mc.segment3 IN ('059') )

  • @Motta, I can’t believe that on a line you solved this...!

  • 1

    Not the OS is boring to answer , you need to write a thesis format ABNT ... :) funfou leaves queito.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.