Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie ? - Howto find nbr records in a table
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
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