Re: Limiting Rows Returned in Query
From: Joe Nardone <nardone_at_patriot.net>
Date: 1996/11/11
Message-ID: <566eed$b58_at_washington.patriot.net>#1/1
Date: 1996/11/11
Message-ID: <566eed$b58_at_washington.patriot.net>#1/1
frank greene (fgreene_at_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_at_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." - EinsteinReceived on Mon Nov 11 1996 - 00:00:00 CET