From: nardone@patriot.net (Joe Nardone)
Subject: Re: Limiting Rows Returned in Query
Date: 1996/11/11
Message-ID: <566eed$b58@washington.patriot.net>#1/1
references: <3283E1D4.57BC@c-square.com.nojunk> <565jn2$agd@inet-nntp-gw-1.us.oracle.com>
organization: Redundant Corporation Corp.
newsgroups: comp.databases.oracle



frank greene (fgreene@us.oracle.com) wrote:
: You were close.  The statement should actually be something like
: 
:      select first_column, second_column, last_column
:      from   the_table
:      where  rownum <= 100
:      ;
: 
: That will return only the first 100 rows from table THE_TABLE.  Variable 
: rownum is a pseudocolumn described in the SQL*Plus manual.
: 

Note however that this will not work (correctly) if you use any
kind of ORDER BY clause; rownum is assigned before that sort, so
you will not get the rows you expect.

To handle this case, you will need to write a PL/SQL block
and do the query that way.

Joe 

-- 
                                   
=-------------------------------------------------------------------------=
Joe Nardone <nardone@patriot.net>
  "There are many dying children out there whose last wish is to meet me."
                                                  - David Hasselhoff
  "The most beautiful thing we can experience is the mysterious.  It is
  the source of all true art and all science.  He to whom this emotion
  is a stranger, who can no longer pause to wonder and stand rapt in awe,
  is as good as dead: his eyes are closed."       - Einstein


