|
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 there's
been a bunch added.
Charles
On Tue, Jul 28, 2020 at 8:11 AM Maria Lucia Stoppa <mlstoppa@xxxxxxxxx>
wrote:
@Charlesat
I've just tried and it returns the number of fetched rows only, not the
total result set length.
I'll take a look at those new features you suggested, hoping they exist
V7R2 also.rows
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 <mlstoppa@xxxxxxxxx
wrote:
Everything works fine, except the same static SQL statement is run atleast
twice to know the total number of rows (a simple count(*)) and the
groupthemselves 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 the
size of the result table to be known, returns the number of rows in the
result
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 select
statements must be run to get some totals according to different
byhttps://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/db2/rbafzolapexp.htm
user.clauses in order to present the data set distribution to the final
Have you looked at the OLAP functions in addition to ROLLUP, CUBE and
grouping sets?
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/db2/rbafzgroupbyclause.htm
extra
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 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.