Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL: put numbers of rows in a variable

Re: SQL: put numbers of rows in a variable

From: Stephan Born <stephan.born_at_beusen.de>
Date: Wed, 03 Nov 1999 11:05:08 +0100
Message-ID: <382008D4.94C4B044@beusen.de>

Dick Segers schrieb:

> Hi there,
>
> From some tables in my database I want to know the number of rows.
> So I use:
>
> SQL> Select count(*) from tablename;
>
> But now I want to fetch the result in a variable ( so I can make some
> readable output )
>
> ========
>
> When that is done I want to make an overview of all user_tables with
> there number of rows.
>
> Thanks in advance,
>
> Dick Segers.

How shall the output look like? The only way to put the result into a variable is to use
PL/SQL.... declare

    Result number;
begin

    select count(*)
    into Result
    from tablename;

    <do what you want with Result>

end;

Regards, Stephan
--


Dipl.-Inf. (FH) Stephan Born   | beusen Consulting GmbH
fon: +49 30 549932-17          | Landsberger Allee 392
fax: +49 30 549932-29          | 12681 Berlin
mailto:stephan.born_at_beusen.de  | Germany
---------------------------------------------------------------
       PGP-Key verfügbar       |      PGP-Key available
---------------------------------------------------------------


Received on Wed Nov 03 1999 - 04:05:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US