SELECT * FROM
(SELECT TITLE FROM MOVIE ORDER BY RANK DESC)
WHERE ROWNUM > 4;

when i run the above query .it produces output as NO ROWS
SELECTED.why ?plz any one help me

Answer Posted / vamsi krishna

the reason behind this is rownum will be generated only
after selecting the row from the table.hence when you are
using inline views ,the outer select statement is having a
rownum and inner select statement is having a rownum,so due
to the ambiguity your query is not working.
i give the following change to ur query.
SELECT * FROM
(SELECT rownum as r1,TITLE FROM MOVIE )
WHERE r1 > 4;

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

567


what is the use of system.effective.date variable in oracle?

675


When system tablespace is created?

608


Is postgres faster than oracle?

563


What is an oracle user account?

585






What are the types of partitions in oracle?

543


Is it possible to center an object horizontally in a repeating frame that has a variable horizontal size ?

1885


Explain what are synonyms used for?

612


How to bring a tablespace online?

522


How to use subqueries with the in operator using oracle?

614


How do I find my oracle client driver version?

532


Which dictionary view(s) would you first look at to understand or get a high-level idea of a given Advanced Replication environment?

1483


How is it different from a normal table?

583


How to best split csv strings in oracle 9i?

597


Are truncate and delete commands same? If so why?

658