Re: how to limit number of records shown in SQL*PLUS?

From: Sybrand Bakker <gooiditweg_at_nospam.demon.nl>
Date: Wed, 18 Jun 2003 19:31:40 +0200
Message-ID: <7d81fv049cgsn8rsb9lam77uh8o8o1rck7_at_4ax.com>


On 18 Jun 2003 09:40:42 -0700, techguy_chicago_at_yahoo.com (Bomb Diggy) wrote:

>Hi,
>
>I thought Oracle has a SQL*PLUS command 'set rowcount 10' or similar.
>Is that only M$ SQL Server?
>
>I don't need a 'top' anything, but if I select a bazillion records on
>accident, I want to see only the first 10.
>
>Thanks.

read up on using rownum.
Beware, the rownum is assigned before any ORDER BY. If you use ORDER BY
wrap the select
like this

select *
from
(select ..... from ....... order by)
where rownum < 10

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Wed Jun 18 2003 - 19:31:40 CEST

Original text of this message