Oracle Display Odd / Even Number of Records

By ruzaib khan

Odd or Even Record Display.

Odd number of records:
select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);
1
3
5
Even number of records:
select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
2
4
6

Oracle Display Odd / Even Number of Records  (1118 Views)