This is simple. Try following query. (I don't really understand what you want to display when the gender = 0. So in my query I display blank when gender is 0)
select name,
case when gender = '0' then ''
when gender = '1' then 'male'
when gender = '2' then 'female' end as gender
from test