Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Count rows from Select Query 3

Status
Not open for further replies.

sahernandez

Programmer
Oct 1, 2002
69
SV
I have this problem.
I need to know how many rows my query it's gona return
I came from SQL and we used @@ROWCOUNT but here it's different.

I know that I can use a Variable and COunt(*) into variable,
But I already did that and when the query doesn't return anything and not sure what I gonna get in my variable.

Can Somebody Help Me..
Thansks
 
If your query selects no rows, the count function will return zero.
 
There is a %ROWCOUNT in Oracle to find the number of rows a cursor has fetched. The count can be used to test before the cursor fetches. If no rows are returned the count variable will be NULL.
 
No version, no OS, no code..Oh Well, Crystal Ball time:
Code:
Select count(*) from sometable where something = something;
Hint : if you are assigning the result to a variable ( select count(*) into :avariable), if 0 rows are returned it may be 0 [smile]
[profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top