DB2 - Problem description
| Problem IC88314 | Status: Closed |
NO ERROR IS RETURNED WHEN INSERTING NULL INTO A COLUMN OF A NICKNAME THAT DOES NOT ALLOW NULL VALUE | |
| product: | |
DB2 FOR LUW / DB2FORLUW / A10 - DB2 | |
| Problem description: | |
When we insert "NULL", which is the output of a UDF, into a
column of a nickname that does not allow NULL values, you may
not receive a SQL0407N error as expected, but actaully the
insert operation is actaully failed, 0 rows is inserted.
The issue is easy to recreate:
SET PASSTHRU SQLSERVER
CREATE TABLE [dbo].[t2]([c1_notnull] [datetime] NOT
NULL,[c2_null] [datetime] NULL)
SET PASSTHRU RESET
CREATE NICKNAME T2 FOR SQLSERVER.dbo.t2
CREATE OR REPLACE FUNCTION STRINGTODATE
(
STR VARCHAR(23)
)
RETURNS DATE
SPECIFIC STRINGTODATE
LANGUAGE SQL
DETERMINISTIC
NO EXTERNAL ACTION
CONTAINS SQL
BEGIN
DECLARE rdate DATE;
--DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET rdate = null;
SET rdate = DATE(STR);
RETURN rdate;
END
db2 => INSERT INTO T2(c1_notnull,c2_null) SELECT
STRINGTODATE(NULL),DATE('2012-06-25 15:00:00.000') FROM
SYSIBM.SYSDUMMY1
DB20000I The SQL command completed successfully.
NOTE: It said insert successfully but actually failed! | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * The users are inserting "NULL", which is the output of a * * UDF, into a column of a nickname that does not allow NULL * * values. * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to InfoSphere Federation Server v101fp2 or later. * **************************************************************** | |
| Local Fix: | |
| available fix packs: | |
DB2 Version 10.1 Fix Pack 2 for Linux, UNIX, and Windows | |
| Solution | |
The problem is first fixed at v101fp2. | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 17.11.2012 31.12.2012 31.12.2012 |
| Problem solved at the following versions (IBM BugInfos) | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 10.1.0.2 |
|
| 10.5.0.2 |
|