CodeSnip: Selecting the nth Record from a Table Using Oracle
page 3 of 3
by Deepankar Sarangi
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 5328/ 100
Article Contents:

Conclusion

Rownum proves to be to a better option than rowid for finding the nth record of a table.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 6 and 2 and type the answer here:

User Comments

Title: Answer to sanjeet's question   
Name: Deepankar Sarangi (Auther)
Date: 11/27/2008 2:35:45 AM
Comment:
select * from emp where rownum <16;
    EMPNO ENAME      ROWID
---------- ---------- ------------------
     7369 SMITH      AAAHW7AABAAAMUiAAA
     7499 ALLEN      AAAHW7AABAAAMUiAAB
     7521 WARD       AAAHW7AABAAAMUiAAC
     7566 JONES      AAAHW7AABAAAMUiAAD
     7654 MARTIN     AAAHW7AABAAAMUiAAE
     7698 BLAKE      AAAHW7AABAAAMUiAAF
     7782 CLARK      AAAHW7AABAAAMUiAAG
     7788 SCOTT      AAAHW7AABAAAMUiAAH
     7839 KING       AAAHW7AABAAAMUiAAI
     7844 TURNER     AAAHW7AABAAAMUiAAJ
     7876 ADAMS      AAAHW7AABAAAMUiAAK
     7900 JAMES      AAAHW7AABAAAMUiAAL
     7902 FORD       AAAHW7AABAAAMUiAAM
     7934 MILLER     AAAHW7AABAAAMUiAAN

select * from emp where rownum <8 minus select * from emp where rownum <7;

    EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
     7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
Title: question   
Name: sanjeet
Date: 5/27/2008 1:19:09 AM
Comment:
Question: display the 7th record of emp table with using rownum.




Question: delete all duplicate records except one record from emp table as empno. , ename, salary,






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 1/8/2009 3:09:59 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search