Home » SQL & PL/SQL » SQL & PL/SQL » total number of rows from a result set
total number of rows from a result set [message #20075] |
Mon, 29 April 2002 06:18 |
JZ
Messages: 8 Registered: March 2002
|
Junior Member |
|
|
Oracle 8i
How can I do this:
before or after I run a query, is there a way to know the total number of rows in the result set?
For example:
query like: select student_name from students where sex='male';
Can I know how many male students are there? (The real query could be more complicated than the example)
Thnx!
|
|
|
|
my example is too simple... [message #20078 is a reply to message #20075] |
Mon, 29 April 2002 06:24 |
JZ
Messages: 8 Registered: March 2002
|
Junior Member |
|
|
How can I count the # of rows being returned from the following query:
select n.destination,n.nfseverity,SUM(n.eventcount)
from highseverityevents n,devices i , nfalarmctgmappings m
where n.deviceid in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
and n.destination IS NOT null
and n.deviceid = i.deviceid
and n.nfalarmid=m.nfalarmid
and m.nfctg like '%'
and n.apptimestamp>= to_date('04/20/2002 00:00:00')
and n.apptimestamp< to_date('04/20/2002 01:00:00')
group by n.destination, n.nfseverity
UNION
select n.destination,n.nfseverity,SUM(n.eventcount)
from lowseverityevents n,devices i , nfalarmctgmappings m
where n.deviceid in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
and n.destination IS NOT null
and n.deviceid = i.deviceid
and n.nfalarmid=m.nfalarmid
and m.nfctg like '%'
and n.apptimestamp>= to_date('04/20/2002 00:00:00')
and n.apptimestamp< to_date('04/20/2002 01:00:00')
and 0= 0
group by n.destination,n.nfseverity
order by 3 desc;
|
|
|
|
|
|
Most simple solution [message #20111 is a reply to message #20075] |
Tue, 30 April 2002 03:42 |
Amit
Messages: 166 Registered: February 1999
|
Senior Member |
|
|
--Just after the DML statement
use
local_variable := sql%rowcount;
bms_output.put_line('local_variable='||local_);
|
|
|
Goto Forum:
Current Time: Wed Apr 24 06:06:20 CDT 2024
|