IBM Support

Inlining support for User Defined Table Functions (UDTFs)

News


Abstract

Inlining support for User Defined Table Functions (UDTFs)

Content

You are in: IBM i Technology Updates > Db2 for i - Technology UpdatesDb2 for i Performance Enhancements > Inlining support for User Defined Table Functions (UDTFs)

CREATE FUNCTION (SQL table) - enhancement to support inlined UDTFs

Inline functions: When an SQL table function is inlined, instead of invoking the function as part of a query, the fullselect in the RETURN statement of the function may be copied (inlined) into the query itself. Such a function is called an inline function. A table function is an inline function if:

  • The SQL function is defined as NO EXTERNAL ACTION.
  • The SQL-routine-body contains only a RETURN statement.
  • No column in the result table is the XML data type.
  • All objects referenced in the function exist when the function is created.
  • The SQL-routine-body does not contain a common table expression that references an input parameter.

An inline function is only copied (inlined) into a query if:

  • The query is eligible for the SQL Query Engine (SQE).
  • The function does not reference a table on a different server.
  • The function references an object and the authority attributes of the function and the query are compatible based on one of the following conditions:
    • The function is defined to run under the user's authority (*USER).
    • The query is running under the owner's authority (*OWNER) and the owner of the query is the same as the owner of the function.
    • The query is running under the user's authority (*USER), and the user or the user's group profile is the same as the owner of the function.
    Note: If the function is defined as FENCED, the query must not use adopted authority. If the query runs under the owner's authority (*OWNER) and the function runs under the user’s authority (*USER), the owner of the query must be the same as the user or the user's group profile.

When a function is inlined, some of the options specified when the function was created are ignored:

  • PARALLEL or NOT PARALLEL
  • MODIFIES SQL DATA
  • Commitment control level
  • CONCURRENT ACCESS RESOLUTION
  • ALWCPYDTA
  • ATOMIC or NOT ATOMIC

If a function is inlined and it contains a reference to a special register, the value of the special register will be the same as other references to the same special register in the query.

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
21 January 2020

UID

ibm11168192