oracle condition in where clause RRS feed

  • Question

  • User-583959464 posted

    how can i add condition in where clause. can i use "case when" in the where clause to update record.

    update table_name set col_1=99 where col_2=xx and col_3=yy and (case when col_4 = '01' then '02'

                                                                                                                          when "02" then "03" when "04" then "05")

    that mean when col_4=01 then the condition is to retrieve record col_4="02" to update.

    or other better way to do that. any example for me.

    Saturday, October 14, 2017 4:35 PM

All replies

  • User269602965 posted

    you left out the left side of the equals comparison

    and col4 = (condition phrase be it CASE or DECODE)

    Monday, October 16, 2017 8:40 PM