Home » Developer & Programmer » Forms » row counting
row counting [message #118865] Mon, 09 May 2005 07:46 Go to next message
jonmich005
Messages: 53
Registered: April 2005
Member
I have something like a grid and I need to count my rows for knowing how big my loop should be.
But I have some rows which are null for seperating some areas.
Now I have the following statement:

While not itl.activity is null loop ...

But how can I tell oracle that it should look over certain null values. Or another statement that it goes to the last record?
Can anyone help me with that?

Greetings Jonas
Re: row counting [message #118951 is a reply to message #118865] Mon, 09 May 2005 19:22 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Go to http://www.oracle.com/technology/documentation/forms.html. Find 'Form Builder Reference'. Download it and search for 'count_query'.

Do this command BEFORE doing the execute_query otherwise it will only tell you how many rows were returned by the first fetch.

David
Re: row counting [message #118976 is a reply to message #118951] Tue, 10 May 2005 02:06 Go to previous messageGo to next message
jonmich005
Messages: 53
Registered: April 2005
Member
But I need to use this count in a while?
I also tried it by a select count(...) but the null values aren't count with this statement or do they?

Greetings
Re: row counting [message #118981 is a reply to message #118865] Tue, 10 May 2005 02:29 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Nulls are not counted. If you want them to count then use NVL and count them.

David
Re: row counting [message #118983 is a reply to message #118981] Tue, 10 May 2005 02:35 Go to previous messageGo to next message
jonmich005
Messages: 53
Registered: April 2005
Member
Ok, so the following should work:

nvl(tl_grid_activity,count(tl_grid_activity)
Re: row counting [message #118984 is a reply to message #118983] Tue, 10 May 2005 02:36 Go to previous messageGo to next message
jonmich005
Messages: 53
Registered: April 2005
Member
but it doesn't.
Re: row counting [message #118985 is a reply to message #118865] Tue, 10 May 2005 02:43 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Try "count(nvl(tl_grid_activity,'X'))"
Re: row counting [message #118986 is a reply to message #118985] Tue, 10 May 2005 02:46 Go to previous messageGo to next message
jonmich005
Messages: 53
Registered: April 2005
Member
What has to become instead of the X?
Again a count or not?
This is what I have:
select count(nvl(tl_grid_activity,tl_grid_activity+1))
Re: row counting [message #118987 is a reply to message #118986] Tue, 10 May 2005 02:50 Go to previous messageGo to next message
jonmich005
Messages: 53
Registered: April 2005
Member
Thanks it works.
I just had to put a ! on that place.
Thnks a lot
Re: row counting [message #118990 is a reply to message #118986] Tue, 10 May 2005 02:54 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
jonmich005 wrote on Tue, 10 May 2005 17:46

What has to become instead of the X?
Again a count or not?
This is what I have:
select count(nvl(tl_grid_activity,tl_grid_activity+1))


The above count is trying to add 1 to null which will give null. I used 'X' as I thought you were counting a character field.
Re: row counting [message #118991 is a reply to message #118987] Tue, 10 May 2005 02:55 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
jonmich005 wrote on Tue, 10 May 2005 17:50

Thanks it works.
I just had to put a ! on that place.
Thnks a lot


I assume you mean 1 (one).
Re: row counting [message #118992 is a reply to message #118990] Tue, 10 May 2005 02:55 Go to previous messageGo to next message
jonmich005
Messages: 53
Registered: April 2005
Member
Yes but if I put 1 instead of the X it works.
Again thank you
Re: row counting [message #118993 is a reply to message #118865] Tue, 10 May 2005 02:55 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
If you want to count NULL and NOT NULL values why not use "count(*)" which counts all rows?
Previous Topic: 2 Problems Form Wont Run Without DataBlock / “FRM-40405”
Next Topic: Problem with BLOB Data.
Goto Forum:
  


Current Time: Thu Sep 19 18:15:26 CDT 2024