IBM Support

Allow LANGUAGE SQL functions to reference files in an IASP and files in SYSBAS

News


Abstract

Allow LANGUAGE SQL functions to reference files in an IASP and files in SYSBAS

Content

You are in: IBM i Technology Updates > Db2 for i - Technology Updates > Db2 for i Functional Enhancements > Allow LANGUAGE SQL functions to reference files in an IASP and files in SYSBAS

SQL functions residing in an IASP can reference tables and views within the IASP and *SYSBAS.
Creating a LANGUAGE SQL function in an IASP that references objects within *SYSBAS used to fail with SQL7008.
QTEMP is considered to belong to *SYSBAS, not the IASP in use by the job.
Example of usage that is now allowed:

CREATE TABLE QTEMP.WORK_TABLE AS (SELECT IBMREQD FROM SYSIBM.SYSDUMMY1) WITH DATA

CREATE FUNCTION IASPLIB.COUNTIT()
RETURNS BIGINT
LANGUAGE SQL FENCED
P1: BEGIN
DECLARE WORK_VARIABLE BIGINT;
SELECT COUNT(*) INTO WORK_VARIABLE FROM QTEMP.WORK_TABLE;
RETURN(WORK_VARIABLE);
END P1
set path = IASPLIB
select COUNTIT() from sysibm.sysdummy1
Result of query:  1

{ "data": [ { "Article Type":"Technical Information (DA700)", "Category":"IBM i Db2", "ARM Category":"IBM i Db2 > UDF - user-defined function", "Keywords":"LANGUAGE SQL; UDF; IASP; SYSBAS; Db2 for i; IBM i; database; SQL; 7.4; 7.3; 7.2", "Predicate":"USAGE", "Classifier":"LEARN" } ] }

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"ARM Category":[{"code":"a8m0z0000001iIWAAY","label":"IBM i Db2-\u003EUDF - user-defined function"}],"Version":"All Versions"}]

Document Information

Modified date:
31 October 2026

UID

ibm11167700