A UDTF can only be specified within the from clause of a SQL Statement.
So, the only way is to join the UDTF with a table or view in the FROM Clause
and then use the results.
If information from the table (such as column values) has to be passed as
parameter to the UDTF you have to deal with LATERAL
... something like this
Select ODOBTX, p.*
From Table(Users()) u,
Lateral(Select *
From Table(Object_Ownership(User_Profile => Odobnm)) x) p
Where Odobnm not Like 'Q%'
and Odobnm not Like '#%'
and Object_Name like '%SALES%'
;
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization ? Education ? Consulting on IBM i
Database and Software Architect
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
"Train people well enough so they can leave, treat them well enough so they
don't want to. " (Richard Branson)
"Learning is experience ? everything else is only information!" (Albert
Einstein)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Justin
Taylor
Sent: Monday, 5 February 2024 17:00
To: MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: UDTF over every row
I have a UDTF that returns a result set.
select E.* from table(MY_UDTF('1', '2')) E;
I need to call that UDTF for every row in a SELECT and return a combined
result set. The following gives "Subselect with more than one result column
not valid.", but I think it helps to show what I'm trying to accomplish.
select ( select E.* from table(MY_UDTF(T.COL1, T.COL2)) E )
from MY_TABLE T
Any suggestions?
TIA
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.