Re: Calling UDTF passing as parameter select field of master file

Daniel Gross <[email protected]> Sat, 14 Feb 2026 22:39:26 +0100
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Hi Gio,

is "getprice" really an UDTF - an User Defined Table Function? Or is it an UDF - an User Defined Function?

From your description of the function I would say, its a UDF - it receives one parameter (item code) and returns one result (price).

You can use it like this:

	select getprice(item.code), item.*
	from item
	order by 1

or

	order by getprice(item.code)

Both will work.

HTH
Daniel


> Am 14.02.2026 um 22:26 schrieb gio.cot via RPG400-L <[email protected]>:
> 
> Hi all
> 
> Suppose i have a file master item  with two fields   : code and descr
> 
> i have an UDTF "getprice",  that have as input code (master code) and that
> return price.
> 
> as i would need to have a result sorted for price, i was asking me if it
> possible to run this SQL statement
> 
> select * from item as i left join table(getprice(:i.code)) as p on i.code =
> p.code order by p.price
> 
> Thanks in advance
> --
> This is the RPG programming on IBM i (RPG400-L) mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/rpg400-l.
> 
> Please contact [email protected] for any subscription related questions.
> 
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact [email protected] for any subscription related questions.