A fix is available
APAR status
Closed as program error.
Error description
Sqlcode -138 is issued when executing query from a view which includes SUBSTR function.
Local fix
N/A
Problem summary
**************************************************************** * USERS AFFECTED: All DB2 10 or 11 for z/OS users of an SQL * * statement containing a view that contains * * UNION ALL and a predicate with SUBSTR * * function. * **************************************************************** * PROBLEM DESCRIPTION: SQLCODE138 M380 could occur for an SQL * * statement satisfying all of the * * following conditions: * * 1. It contains a view that references * * a table expression with UNION ALL. * * 2. The corresponding select list of * * UNION ALL has different string length * * field. * * 3. There is predicate with SUBSTR * * function which references the column * * from the table expression with UNION * * ALL. * **************************************************************** * RECOMMENDATION: * **************************************************************** An example is shown below: CREATE TABLE T1(C1 CHAR(10) NOT NULL, C2 VARCHAR(10) NOT NULL); CREATE TABLE T2(C1 CHAR(10) NOT NULL, C2 VARCHAR(10) NOT NULL); CREATE VIEW V1 AS SELECT TX1.C1, TX1.C2 FROM (SELECT C1, C2 FROM T1 UNION ALL SELECT C1, '' AS C2 FROM T2 ) AS TX1(C1, C2) WHERE SUBSTR(TX1.C2, 1, 2) = 'AB' ; SELECT * FROM V1; DB2 did not correctly process the aforementioned SQL and resulted in SQLCODE138 M380.
Problem conclusion
DB2 has been modified to correctly process the aforementioned SQL statement. Additional Keywords: SQLUNIONALL SQLVIEW
Temporary fix
Comments
APAR Information
APAR number
PI78055
Reported component name
DB2 OS/390 & Z/
Reported component ID
5740XYR00
Reported release
B10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2017-03-14
Closed date
2017-04-11
Last modified date
2017-05-01
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
PI79648 UI46352 UI46353
Modules/Macros
DSNXOP1
Fix information
Fixed component name
DB2 OS/390 & Z/
Fixed component ID
5740XYR00
Applicable component levels
Fix is available
Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEPEK","label":"Db2 for z\/OS"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.0","Edition":"","Line of Business":{"code":"","label":""}}]
Document Information
Modified date:
01 May 2017