Question

Asked on 2001-02-21 at 08:02:56ID: 25482610

Need Oracle equivalent to SELECT TOP in MS SQL.

by: jmnolan300

Rating5.8Good

In SQL Server you can do a "SELECT TOP 100 FROM table ORDER BY field1" and get the first 100 rows in a table. Is there an equivalent function in Oracle? What is the best way to accomplish this? I have a number of tables with potentially hundreds of thousands of records and I need to be able to pull the first 1500 from any of these tables. The data is not in any specific order so I can't guess at where the 1500th record is. Ideally, I don't want to execute more than a couple queries to get this result.

NOTE: I don't need exactly 1500 rows. A few hundred extra is fine, but 1500 at a minimum.

Thanks!

  1. How to display row ascending number in a query…
    Hello, Maybe this one has been asked many times, but how can I display a row or record number for each record in a query? When trying to do a query like: select name_field, country_field from MyTable order by name_field; I would like to display these results: # Name Country -------------…
  2. Need to Duplicate rows in a select statement
    Please see the attached SQL. The field PKG_COUNT has the actual number of packages... ie one row in the table, pkg_count is 2. This really means that there were 2 packages shipping for that shipping record. I need a way to show that in a select statement, but duplicate the 20493458 record to actuall show it twice, show the 20499684 re…
  3. How to flat a table in DB2 or ORACLE PL/SQL…
    Environment: DB2 8.0 or 9.0 (but you can resolve the problem in Oracle PL/SQL, if you like) Please suppose to have the following table (I use Oracle syntax, but the environment is DB2 8.0 or 9.0 by IBM): CREATE TABLE TEST001 ( YYYYMMDD NUMBER(8), HH24MM NUMBER(4), FLAG VARCHA…
  4. SQL Select Top or Select Max
    Hi guys, I've got a query (attached below) and I only want to see the most recent record. How can I do this? Do I need a Select Top 1 or Select Max?
  5. Oracle "order by" question
    I have a query listed below: 1. select priority_level, ID from product order by priority_level, ID DESC The result will be: priority_level ID 9 20086750 93 20086845 100 20087773 100 20086884 100 20086843 2. select…

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
oracle top select equivalent
Participating Experts
7
Solution Grade
A

Replies

 by:

Posted on 2001-02-21 at 08:13:12ID: 28371149

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: ser6398

Posted on 2001-02-21 at 08:16:21ID: 28371150

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 08:19:30ID: 28371151

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: ser6398

Posted on 2001-02-21 at 08:29:47ID: 28371152

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 08:37:11ID: 28371153

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: syakobson

Posted on 2001-02-21 at 08:37:49ID: 28371154

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: maturner

Posted on 2001-02-21 at 08:38:28ID: 28371155

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 08:40:20ID: 28371156

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 08:42:34ID: 28371157

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 08:43:27ID: 28371158

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: ser6398

Posted on 2001-02-21 at 08:46:15ID: 28371159

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 08:51:15ID: 28371160

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: maturner

Posted on 2001-02-21 at 08:52:39ID: 28371161

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 08:58:12ID: 28371162

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: markgeer

Posted on 2001-02-21 at 09:00:47ID: 28371163

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: maturner

Posted on 2001-02-21 at 09:01:01ID: 28371164

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: fva

Posted on 2001-02-21 at 09:05:11ID: 28371165

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: slimdave

Posted on 2001-02-21 at 12:35:13ID: 28371166

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: markgeer

Posted on 2001-02-21 at 13:32:26ID: 28371167

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-21 at 13:50:43ID: 28371168

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: otnxmem

Posted on 2001-02-21 at 23:56:44ID: 28371169

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: maturner

Posted on 2001-02-22 at 00:39:40ID: 28371170

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jmnolan

Posted on 2001-02-22 at 08:33:48ID: 28371171

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert