This forum is currently locked. You can't register or post questions at this time. (read more)

Getting last N records Using rownum

All posts relating to Oracle PL/SQL development.

Moderator: Tim...

Guru3i
Senior Member
Posts: 96
Joined: Fri Aug 24, 2007 7:17 am

Getting last N records Using rownum

Postby Guru3i » Sat Dec 12, 2009 12:52 pm

Hi Tim,

Advanced Christmas Greetings.

I want to have a query which lists only the last N records from a table. I need to do this only using rownum function. Can you please help me in doing this. If my table has 100 records, i should be able to see only the record from 91 to 100. Hope i have made it clear.

Thanks in advance

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Getting last N records Using rownum

Postby Tim... » Sun Dec 13, 2009 4:10 pm

Hi.

You need to use a Top-N query:

http://www.oracle-base.com/articles/mis ... ueries.php

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

Guru3i
Senior Member
Posts: 96
Joined: Fri Aug 24, 2007 7:17 am

Re: Getting last N records Using rownum

Postby Guru3i » Sat Feb 06, 2010 5:43 am

Hi Tim,

Say i have 100 rows in a table and i want to delete rows from rownum 50 to 75, how could i do this. Please help.

Thanks

Guru3i
Senior Member
Posts: 96
Joined: Fri Aug 24, 2007 7:17 am

Re: Getting last N records Using rownum

Postby Guru3i » Sat Feb 06, 2010 6:24 am

Hi Tim,

I was able to write for myself, thanks for your time.

Thanks

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Getting last N records Using rownum

Postby Tim... » Sat Feb 06, 2010 9:12 am

:)
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog


Return to “Oracle SQL and PL/SQL Development”

Who is online

Users browsing this forum: No registered users and 3 guests

cron