home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.oracle
- Path: sparky!uunet!comp.vuw.ac.nz!cc-server4.massey.ac.nz!M.W.Stern
- From: M.W.Stern@massey.ac.nz (M.W. Stern)
- Subject: Re: SQL*plus -- limiting maximum number of returned rows?
- Message-ID: <1992Aug31.223520.28312@massey.ac.nz>
- Organization: Massey University, Palmerston North, New Zealand
- References: <BtuK40.8By@ef2007.efhd.ford.com>
- X-Reader: NETNEWS/PC Version 2c
- Date: Mon, 31 Aug 92 22:35:20 GMT
- Lines: 39
-
-
- > In SQL*Plus (not embedded SQL!) is there any way of limiting the number
- > of rows returned by a query?
-
- > I am working on a report that is supposed to find the "top 5" items in
- > a catagory. The query returns 0 or more rows based on the selection
- > criteria, sorted in the appropriate order. Some queries return a dozen
- > or more rows, but I'm only interested in the first 5.
-
- I believe the answer to this goes something like this,
-
- SELECT value FROM table WHERE ROWNUM <= 5
-
- > If I were using embedded SQL in a C program (or a perl script using
- > oraperl) the solution would be trivial. For internal reasons, however,
- > I'm stuck with using SQL*Plus.
-
- I think the above solution is pretty trivial as well.
-
- > Any ideas?
-
-
- > --
- > Bill Meahan
- > --
- > Bill Meahan |EFHD Information Systems Staff
- > Technical Consultant |Ford Motor Company
- > wwm@ef2007.efhd.ford.com | +1 313 487 6122
- > ...!fmsrl7!ef2007!wwm |I'm not paid to speak for Ford!
-
-
- ==============================================================================
- Mark Stern | "There are holes in the sky,
- Analyst/Programmer | where the rain gets in,
- Massey University | but they're ever so small,
- NEW ZEALAND | that's why rain is thin"
- Internet: | ...
- M.W.Stern@massey.ac.nz | by Spike Milligan
- ==============================================================================
-