5 Replies Latest reply on Jun 18, 2019 6:47 AM by Mustafa KALAYCI

    select statement in CASE caluse

    imation3m

      Hi,

       

      I need to get the records from a table1 based on another table2 only in one case is true, other wise return all records from table 1.

       

      Sample Query

      select *

      from Table1 T1

      where 1=1

      and CASE WHEN :P_BATCH_TYPE = 'C' THEN

              (T1.COL1, T1.COL2) in (select TEXT1, TEXT2 FROM Table2)

          ELSE

              1=1

          end

      ;