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

Explain the use of analyse option in exp command.

584


HI Friends Myself Manoj,i am from bengaluru.i have 1 yr of exp in PLSQL but not upto the mark..now attending interviews but m not able to clear even 1 round..i have attended 3 interviews till today.purpose of writing this query is,i want to know the intreview topics that interviewer going to ask frequently,mainly SCENARIO based questions.IF anybody have any PLSQL projects please give it to me,it will helps me alot.Thanks for your patience.

992


What is raw datatype in oracle?

581


What is ASM (Automatic Storage Management) in Oracle?

710


How to use subqueries in the from clause in oracle?

579






Difference between pre-select and pre-query

573


How to revoke create session privilege from a user in oracle?

555


How can I convert single byte kana characters into multi byte kana characters and vice-versa.

1933


How do I call oracle stored procedures that take no parameters?

562


Explain the use of show option in imp command.

638


From the following identify the non schema object: packages, triggers, public synonyms, tables and indexes.

585


What is the recommended interval at which to run statspack snapshots, and why?

2431


What is instant client oracle?

539


How to write text literals in oracle?

606


What is a oracle database?

605