For Even row
Select * from (select rownum rn, e.* from emp e) Where mod (rn,2)=0;
For Odd row
Select * from (select rownum rn, e.* from emp e)
Where mod (rn,2)!=0;
Using Dense_rank()
Even row
Select * from (
Select dense_rank() over(order by empno)as rank ,e.* from emp e )
Where mod(rank,2)=0;
output on tool
Odd row
Select * from (
Select dense_rank() over(order by empno)as rank ,e.* from emp e )
Where mod(rank,2)!=0;
output on tool
Using decode
Even row
Select * from emp
Where empno in (
Select decode (mod(rownum,2),0,empno,null )
From emp)
output on tool
Odd row
Select * from emp
Where empno in (
Select decode (mod(rownum,2),1,empno,null )
From emp)
output on tool
Using case
Even row
Select * from emp
Where empno in
(select case mod(rownum,2)
When 0 then empno
End
From emp);
odd row
Select * from emp
Where empno in
(select case mod(rownum,2)
When 1 then empno
End
From emp);