V11R1 application compatibility level
When you set the application compatibility level to V11R1, applications that attempt to use functions and features that are introduced in Db2 12 or later might behave differently or receive an error.
When new function is activated in your Db2 13 environment, you can run individual applications with some of the features and behavior of Db2 11. That is, your applications can continue to experience V11R1 behavior after new function is activated in Db2 12 or later. Then, you can migrate each application to a new application compatibility value separately until all are migrated. If application compatibility level is set to V11R1 and you attempt to use the new functions of a later version, SQL might behave differently or result in a negative SQL codes, such as -4743.
You can run package level accounting or monitor traces with IFCID 0239 and review field QPACINCOMPAT, which indicates an SQL incompatible change. If a trace is started for IFCID 0376, and application compatibility is set for a previous version, details about features and functions that have a change in behavior are written in field QW0376FN.
The following table shows some features and functions that are controlled by application compatibility, and the results if you specify V11R1. If a behavior difference is traced, then the IFCID trace function code is shown.
Feature or Function | Result with V11R1 application compatibility | IFCID 0376 trace function code |
---|---|---|
The POWER built-in function returns a result with the DOUBLE data type. The result is out of range. | SQLCODE -802 | 1201 |
CURRENT_SERVER or CURRENT_TIMEZONE is used as a column name or variable name. | SQLCODE -206 | 1204 |
SQL changes in application compatibility level V11R1
The following SQL capabilities are available in Db2 11 new-function mode or later for applications that run at application compatibility level V11R1 or higher.
Any attempt to use the capabilities in the following table at a lower application compatibility level than V11R1 results in an error condition, such as SQL code -4743 or others. For more restrictions that apply at lower application compatibility levels, see V11R1 application compatibility level.
New SQL statements in Db2 11
SQL statement | Description |
---|---|
CREATE | The CREATE TYPE (array) SQL statement defines an array type at the current server. |
CREATE VARIABLE statement | The CREATE VARIABLE statement creates a global variable at the current server. |
SET CURRENT ACCELERATOR statement | The SET CURRENT ACCELERATOR changes the value of the CURRENT ACCELERATOR special register. |
SET CURRENT APPLICATION COMPATIBILITY statement | The SET CURRENT APPLICATION COMPATIBILITY statement changes the value of the CURRENT APPLICATION COMPATIBILITY special register. |
SET CURRENT TEMPORAL BUSINESS_TIME statement | The SET CURRENT TEMPORAL BUSINESS_TIME statement changes the value of the CURRENT TEMPORAL BUSINESS_TIME special register. |
SET CURRENT TEMPORAL SYSTEM_TIME statement | The SET CURRENT TEMPORAL SYSTEM_TIME statement changes the value of the CURRENT TEMPORAL SYSTEM_TIME special register. |
SET assignment-statement statement | The SET assignment-statement statement is a reclassification of the documentation of the SET host-variable and SET transition-variable statements into a single statement. |
SQL statement changes in Db2 11
The following table shows the changes to existing SQL statements that applications can use in application compatibility level V11R1 or higher.
SQL statement | Description of enhancements and notes |
---|---|
ALTER FUNCTION (SQL scalar) |
|
ALTER PROCEDURE (SQL native) |
|
ALTER TABLE |
|
ALTER TABLESPACE |
|
COMMENT |
|
CREATE FUNCTION (SQL scalar) |
|
CREATE INDEX |
|
CREATE PROCEDURE (external) |
|
CREATE PROCEDURE (SQL native) |
|
CREATE TABLESPACE |
|
DECLARE GLOBAL TEMPORARY TABLE |
|
DROP |
|
EXECUTE |
|
FETCH |
|
GRANT (function or procedure privileges) |
|
GRANT (type or JAR privileges) |
|
OPEN |
|
REVOKE (function or procedure privileges) |
|
REVOKE (type or JAR privileges) |
|
SELECT INTO |
|
SET PATH |
|
SQL statement with subselect |
|
VALUES INTO |
|
New built-in functions in Db2 11
Db2 11 introduces new built-in functions that improve the power of the SQL language. The following table shows the new built-in functions.
Function name | Description |
---|---|
ARRAY_AGG aggregate function | The ARRAY_AGG function returns an array in which each value of the input set is assigned to an element of the array. |
ARRAY_DELETE scalar function | The ARRAY_DELETE function deletes elements from an array. |
ARRAY_FIRST scalar function | The ARRAY_FIRST function returns the minimum array index value of an array. |
ARRAY_LAST scalar function | The ARRAY_LAST function returns the maximum array index value of an array. |
ARRAY_NEXT scalar function | The ARRAY_NEXT function returns the next larger array index value, relative to a specified array index value. |
ARRAY_PRIOR scalar function | The ARRAY_PRIOR function returns the next smaller array index value, relative to a specified array index value. |
BLOCKING_THREADS table function | The BLOCKING_THREADS function returns a table that contains one row for each lock or claim that threads hold against specified databases. |
CARDINALITY scalar function | The CARDINALITY function returns the number of elements in an array. |
CHAR9 scalar function | The CHAR9 function returns a fixed-length character string representation of the argument. The CHAR9 function is intended for compatibility with previous releases of Db2 for z/OS that depend on the result format that is returned for decimal input values in Version 9 and earlier. Important: For portable applications that might run on platforms other than Db2 for z/OS, use the CHAR function instead. Other Db2 family products do not support the CHAR9 function.
|
MAX_CARDINALITY scalar function | The MAX_CARDINALITY function returns the maximum number of elements that an array can contain. |
MEDIAN | The MEDIAN function returns the median of a set of numbers. This function can run only on an accelerator server. |
TRIM_ARRAY scalar function | The TRIM_ARRAY function deletes elements from the end of an ordinary array. |
VARCHAR9 scalar function | The VARCHAR9 function returns a fixed-length character string representation of the argument. The VARCHAR9 function is intended for compatibility with previous releases of Db2 for z/OS that depend on the result format that is returned for decimal input values in Version 9 and earlier. Important: For portable applications that might run on platforms other than Db2 for z/OS, use the VARCHAR function instead. Other Db2 family products do not support the VARCHAR9 function.
|