Display Odd/ Even number of records?
Answers were Sorted based on User's Feedback
Answer / nishi
Select rownum,empno,ename,salary from emp group by rownum,empno,ename,salary having Mod(rownum,2)=0 -- To display EVEN records.
Select rownum,empno,ename,salary from emp group by rownum,empno,ename,salary having Mod(rownum,2)=1 -- To display ODD records.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / 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 |
Answer / shareef
select * from emp where (rowid,0) in(select rowid,mod(rownum,2) from emp);---even
select * from emp where (rowid,1) in(select rowid,mod(rownum,2) from emp);---odd
| Is This Answer Correct ? | 2 Yes | 0 No |
can a view be updated?
What is enter substitution variable in oracle?
Assuming that you are an End User How to find that in the payment Batch some of the Invoice was Missing To pay How to find That??
What is a cognitive schema?
What are the differences between date and timestamp in oracle?
What is merge in oracle?
What is SAVE POINT ?
what is meant by magic query
What are the advantages of Views ?
ex. one table is having 1 column with 10 records , then how to display all the values in row wise ?
How do I reset a sequence in oracle?
How to set a transaction to be read only in oracle?