select rownum as rn,a.*,case when depat_nam1 is null then parent_nam else depat_nam1 end as depat_nam