Oracle — Tricky Update query

Sample Person Table:-

Question No.(1)- I need to update the Gender column M => Male and F=> Female, in whole person table.

We can update this using two Oracle Function DECODE & CASE



Updating Gender Column with DECODE Function

Question No. (2):- I want to update the same Gender column, M => F and F => M, i.e. wherever we have M Update it with F and wherever we have F update with M.

This we can do using both DECODE and CASE, as i have already explained how to use both function. to solve this Question i will use CASE function.

CASE function