|
Are you LIMITing the cursor to 50 rows?
If you're using LIMIT/OFFEST or FETCH FIRST in the cursor, that would make
sense.
Charles
On Tue, Jul 28, 2020 at 9:40 AM Maria Lucia Stoppa <mlstoppa@xxxxxxxxx>
wrote:
@Charlesthere's
I did it, but it doesn't work.
[image: image.png]
wTotalRows equals to 50 which is wRowsToRead instead of 994, as it should
be.
Il giorno mar 28 lug 2020 alle ore 16:21 Charles Wilt <
charles.wilt@xxxxxxxxx> ha scritto:
Again, use the GET DIAGNOSTICS after the OPEN, not the FETCH.
The grouping stuff is in 7.2, some of the OLAP functions are, but
thebeen a bunch added.
Charles
On Tue, Jul 28, 2020 at 8:11 AM Maria Lucia Stoppa <mlstoppa@xxxxxxxxx
wrote:
@Charles
I've just tried and it returns the number of fetched rows only, not
existtotal result set length.
I'll take a look at those new features you suggested, hoping they
runatmlstoppa@xxxxxxxxx
V7R2 also.
Il giorno mar 28 lug 2020 alle ore 15:58 Charles Wilt <
charles.wilt@xxxxxxxxx> ha scritto:
On Tue, Jul 28, 2020 at 3:17 AM Maria Lucia Stoppa <
wrote:
Everything works fine, except the same static SQL statement is
atthe
least
twice to know the total number of rows (a simple count(*)) and
therows
themselves page by page.
GET DIAGNOSTIC DB2_NUMBER_ROWS is what you want to look at here.
If the previous SQL statement was an OPEN or a FETCH which caused
finalthesize of the result table to be known, returns the number of rows in
selectresult
table. For SENSITIVE cursors, this value can be thought of as an
approximation since rows inserted and deleted will affect the next
retrieval of
this value. Otherwise, the value zero is returned.
Run it after you OPEN your cursor, before you FETCH.
Now, on the same data retrieved by this SQL statement, others
groupstatements must be run to get some totals according to different
by
clauses in order to present the data set distribution to the
anduser.
Have you looked at the OLAP functions in addition to ROLLUP, CUBE
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/db2/rbafzolapexp.htmgrouping sets?
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/db2/rbafzgroupbyclause.htm
affiliateaffiliateextra
When I started writing SQL on the AS/400, (sub)totaling required an
relatedstatement.
That is no longer the case.
Charles
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
questions.
Help support midrange.com by shopping at amazon.com with our
relatedlink: https://amazon.midrange.com
--
Maria Lucia Stoppa
mlstoppa@xxxxxxxxx
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
questions.
Help support midrange.com by shopping at amazon.com with our
relatedlink: https://amazon.midrange.com--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
--questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
Maria Lucia Stoppa
mlstoppa@xxxxxxxxx
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.