× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Chuck!

Can you or anyone else explain what the following does? I've never seen
the LATERAL (aka TABLE) keyword and, even after reading up a bit in the SQL
Reference, I'm still not sure what this is doing:

FROM QSYS.QADBXATR A
, LATERAL
( SELECT *
FROM TABLE
( QSYS2.PARTITION_STATISTICS(A.DBXLIB, A.DBXFIL)
) AS X
) AS B

- Dan

On Thu, Feb 26, 2015 at 11:35 AM, CRPence <CRPbottle@xxxxxxxxx> wrote:

On 25-Feb-2015 16:58 -0600, Dan wrote:


For those who are curious, I took the CREATE VIEW DDL from the DSPFD
and made it readable:

CREATE VIEW SYSPARTITIONSTAT (
TABLE_SCHEMA FOR COLUMN TABSCHEMA,
TABLE_NAME FOR COLUMN TABNAME,
<<SNIP>>
AS SELECT
A.DBXLB2,
A.DBXLFI,
<<SNIP>>
FROM QSYS.QADBXREF A
, LATERAL
( SELECT *
FROM TABLE
( QSYS2.PARTITION_STATISTICS(A.DBXLIB, A.DBXFIL)
) AS X
) AS B
WHERE A.DBXATR IN ('TB','PF','MQ' ) AND A.DBXREL = 'Y'


So create your own query [optionally encapsulated in a VIEW] that will
limit the amount of data generated; results generated by the UDTF that are
then just discarded by the implied or explicit selection to include only
"source physical files". For example:

SELECT
A.DBXLIB as SRCPF_LIBR
, A.DBXFIL as SRCPF_NAME
, B.LAST_SOURCE_UPDATE_TIMESTAMP as SRCPF_UDAT
, B.SOURCE_TYPE as SRCPF_SRCTYPE
[...]
FROM QSYS.QADBXATR A
, LATERAL
( SELECT *
FROM TABLE
( QSYS2.PARTITION_STATISTICS(A.DBXLIB, A.DBXFIL)
) AS X
) AS B
WHERE A.DBXATR = 'PF' /* minimize data to only PFs */
AND A.DBXREL = 'Y' /* probably moot */
AND A.DBXTYP = 'S' /* the "PF" is a PF-SRC */
AND B.SOURCE_TYPE IS NOT NULL

--
Regards, Chuck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.