SQL and Data
Prior to V2R1, the HAVING clause was evaluated after the SELECT clause. This caused a statement such as the following to fail on a zero divide and generate SQLCODE -802, if a zero part number was encountered:
SELECT 200/PARTNO FROM T1 GROUP BY PARTNO HAVING PARTNO > 0
In V2R1, the HAVING clause is evaluated before the SELECT clause. This means your applications now have the potential of producing different results. In the above example, if a zero part number is encountered, the query does not fail and SQLCODE -802 is not generated.
Prior to V2R1, if any row had a null value in one of the columns referenced in a GROUP BY clause, each such row was treated as a separate group.
In V2R1, null values are considered identical for purposes of grouping.
This means that your existing applications may generate fewer rows in the result table than they did in previous releases, since multiple null-value-groups are now consolidated into one group. Any derived column function values will reflect this consolidation (for example, SUM(BONUS)).
Prior to V2R1, the system recognized negative decimal zero as a valid value. However, it did not evaluate positive and negative decimal zero values as equivalent.
In V2R2, any negative decimal zeros found in SQL statements are converted to positive decimal zeros before execution. This means that inserting, updating, or deriving negative decimal zeros, or using them in a comparison, is no longer possible. A utility called SQLZERO is provided which converts all negative decimal zeros in the database to positive decimal zeros.
For a detailed discussion of this topic, see "Elimination of Negative Decimal Zero" in the chapter which discusses migrating from V1R3.5 in the System Planning and Administration manual, V2R1 or later.
Prior to V2R1, it was possible to insert invalid decimal data into the database during DATALOAD by specifying string values that were invalid for DECIMAL columns. For example, X'0000' has no sign value.
In V2R1, this is no longer allowed. Doing so will generate SQLCODE -424.
Application Programming
Prior to V2R1, the SELECT INTO statement was allowed to contain an ORDER BY clause.
In V2R1, this is no longer allowed. Doing so will generate SQLCODE -524.
Prior to V2R1, a prepared statement could sometimes, but not always, be referenced in subsequent logical units of work (LUWs).
In V2R1, this inconsistency is removed. A prepared statement may now only be referenced within the same LUW in which it was prepared.
If your applications contain code that references prepared statements across LUWs, they will have to be restructured accordingly.
Prior to V2R1, when a format 2 INSERT (known as "INSERT via subselect" in V2R2 and later releases) returned an empty answer set for insertion, SQLCODE +0 was generated.
In V2R1, SQLCODE +100 is generated instead.
Prior to V2R1, a certain set of conditions generated errors during preprocessing.
In V2R1, these conditions now generate warnings, although the associated
SQLCODEs are still negative (starting with V3R1, the codes are presented as
positive numbers). These conditions and their corresponding SQLCODEs
are shown in the table below.
SQLCODE | DESCRIPTION |
---|---|
-134 | IMPROPER USE OF THE LONG FIELD COLUMN column. |
-135 | THE INPUT FOR A LONG FIELD COLUMN IN AN INSERT OR UPDATE MUST BE FROM A HOST VARIABLE OR THE KEYWORD NULL. |
-150 | THE VIEW CANNOT BE USED TO MODIFY DATA SINCE IT IS BASED ON MORE THAN ONE TABLE. |
-151 | A COLUMN OF A VIEW CANNOT BE UPDATED SINCE IT IS DERIVED FROM AN EXPRESSION. |
-152 | A COLUMN OF A VIEW CANNOT BE USED IN A WHERE-CLAUSE SINCE IT IS DERIVED FROM A COLUMN FUNCTION. |
-154 | VIEW LIMITATIONS DO NOT ALLOW THE USE OF THE FOLLOWING OPERATION: operation |
-155 | YOU CANNOT PERFORM A JOIN ON A VIEW CONTAINING A GROUP-BY CLAUSE OR A DISTINCT KEYWORD. |
-156 | RESTRICTIONS APPLY WHEN SELECTING FROM A VIEW CREATED WITH THE DISTINCT OR GROUP BY KEYWORD. |
-202 | COLUMN column WAS NOT FOUND IN ANY TABLE REFERENCED BY THE COMMAND. |
-205 | COLUMN column WAS NOT FOUND IN TABLE creator.table. |
-401 | INCOMPATIBLE DATA TYPES FOUND IN AN EXPRESSION OR COMPARE OPERATION. |
-404 | A CHARACTER STRING SPECIFIED IN AN INSERT OR UPDATE IS TOO LARGE FOR THE TARGET COLUMN. |
-405 | THE NUMERIC VALUE, value, IS NOT WITHIN THE RANGE OF THE DATA TYPE. |
-407 | AN UPDATE OR INSERT OF A NULL VALUE FOR A COLUMN DEFINED AS NOT NULL IS NOT ALLOWED. |
-408 | AN UPDATE OR INSERT OF A DATA VALUE IS INCOMPATIBLE WITH THE DATA TYPE OF THE ASSOCIATED TARGET COLUMN. |
-414 | LIKE WAS USED FOR A NUMERIC OR DATE/TIME COLUMN TYPE. IT MUST ONLY BE USED WITH CHAR OR VARCHAR TYPE COLUMNS. |
-415 | THE DATA TYPES OF CORRESPONDING ITEMS IN THE SELECT-CLAUSES CONNECTED BY A UNION ARE NOT IDENTICAL. |
-416 | YOU CANNOT SPECIFY A LONG FIELD COLUMN IN THE SELECT-CLAUSE OF A UNION. |
-419 | THE PRECISION OF THE NUMERATOR AND/OR THE SCALE OF THE DENOMINATOR ARE TOO LARGE FOR DECIMAL DIVISION. |
-421 | A HEXADECIMAL LITERAL WITH AN ODD LENGTH MAY NOT BE USED WITH A DBCS COLUMN IN A PREDICATE. |