Re: SQL UDF to call RPG without service program

Daniel Gross <[email protected]> Tue, 3 Mar 2026 19:12:39 +0100
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
You can of course return multiple values, when using a table function.

A user defined table function (UDTF) can return multiple columns and/or multiple rows. 

UDTFs are the more-modern variant of stored procedures that "return" multiple values in IN/OUT or OUT parameters, or stored procedures that return a result set.

Regards,
Daniel


> Am 03.03.2026 um 18:47 schrieb Charles Wilt <[email protected]>:
> 
> Vern,
> 
> You can get something back from stored procs or functions.
> 
> Functions can only return 1 piece of data (could be an array now-a-days) ,
> stored procs can have multiple output (or IN/OUT) parms.
> 
> Just like an RPG Program, an SQL stored proc usually does some
> significant chunk of work.  Whereas a a SQL function or RPG Procedure tends
> to do some smaller (usually repeated) work.
> 
> Repeated invocation is the point for UDFs, as shown in Roberts example:
> SELECT
>       ivwhid AS "Warehouse",
>       ivitm# AS "Item Number",
>       GETUPCHARGEFUNC(ivwhid, ivitm#) AS "Up Charge"
>  FROM invmasp
> WHERE ivwhid = 90
>   AND ivitm# = 5
> ORDER BY 1, 2;
> 
> Charles
> 
>> 
>> 
> --
> 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.