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: Newbie ? - Howto find nbr records in a table

Re: Newbie ? - Howto find nbr records in a table

From: TurkBear <johng_at_nospam.mm.com>
Date: Tue, 06 Oct 1998 15:45:24 GMT
Message-ID: <361a3956.7004491@news2.mm.com>


I don't have my PL/SQL syntax handy but in SqlPlus it would be

select count(*) from table_name

This will return the # of rows ( and therefore records) in the table table_name

For Pl/Sql the psuedocode would be something like:

define ( declare ) a numeric variable X number(6) [ this will handle up to 999,999 records ] and set it to 0
define a cursor MyCur as select * from table_name create a loop
in the loop do a fetch ( get 1 record )  If no record found exit the loop
  set X to X + 1
repeat
use the final value of X to return the total count to the program that needs it



Hope this helps,

Brian Richardson <RichaBK_at_kscgws00.ksc.nasa.gov> wrote:

>Hello,
>
>I want to find out how many records (total) are in a table. I'm writing
>some
>PL/SQL to allow a user to interact with an Oracle database from a
>pc-based
>browser.
>
>Can anyone suggest a simple method for this ?
>
>Environment: Oracle v.7.3.x, Sun Solaris, Netscape clients, PL/SQL
>Packages
>
>Thanks in advance.
>
>Brian Richardson
>

To reply please remove the 'nospam' part of the address Received on Tue Oct 06 1998 - 10:45:24 CDT

Original text of this message

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