Display Odd/ Even number of records?

Answer Posted / swastik mohanty

--TO FIND EVEN NUMBER
SELECT * FROM Table
WHERE ROWID IN (SELECT DECODE(MOD(ROWNUM, 2), 0, ROWID, NULL) FROM Table);
--TO FIND ODD NUMBER
SELECT * FROM Table
WHERE ROWID IN (SELECT DECODE(MOD(ROWID, 2), 1, ROWID, NULL) FROM Table);

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is index-organized table in Oracle?

565


Is a rollback possible to any savepoint?

554


What privilege is needed for a user to create tables in oracle?

546


what is port in oracle? how is it related to database application.

1432


What do you mean by a deadlock?

513






What do you mean by a tablespace?

560


What is a named program unit?

576


Can the query output be sorted by multiple columns in oracle?

567


What is the best way to do multi-row insert in oracle?

559


What is oracle rowcount?

571


What is a user account in oracle?

625


What is Data Dictionary Cache in Oracle?

657


How to download oracle database 10g xe?

595


How we can able to import our own template (users designed MS-Word templates) which has many tabular columns; need to pass some values generate by Oracle-reports9i? Actually need to import more than 400 MS-Word templates into Oracle Reports-9i to minimize layout design in Reports.

1608


What is a server parameter file in oracle?

587