home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IC99367 Status: Closed

MAY RECEIVE SQL0811N WHEN A QUERY OR SUB-SELECT IS USED IN SCALAR CONTEXT
AND RELATED TABLE IS COLUMN ORGANIZED

product:
DB2 FOR LUW / DB2FORLUW / A50 - DB2
Problem description:
When the query or sub-select is used in a scalar context, such 
as a scalar subquery, SELECT ... INTO, UPDATE ... SET, then 
SQL0811N error may be reported if one of the following two 
conditions is true: 
   1) the subquery contains both an ORDER BY and FETCH FIRST 1 
ROW ONLY clauses 
   2) the subquery is correlated and it contains FETCH FIRST 1 
ROW ONLY clause 
Note: The problem will only happen when the table involved in 
the subquery is column organized. 
 
Example 1: Subquery contains ORDER BY and FETCH FIRST 1 ROW ONLY 
clauses 
   $ db2 "create table t1 ( c1 int, c2 int) organize by column"; 
   $ db2 "insert into t1 values(1,1),(2,2)"; 
 
   $ db2 -td@ -vf sp1.db2 
   create or replace procedure sp1() 
   begin 
           declare i_count integer default 0; 
 
           select c1 into i_count 
           from t1 
           order by c2 
           fetch first 1 row only; 
   end 
   DB20000I  The SQL command completed successfully. 
 
   $ db2 "call sp1()" 
   SQL0811N  The result of a scalar fullselect, SELECT INTO 
statement, or VALUES 
   INTO statement is more than one row.  SQLSTATE=21000 
 
Example 2: Subquery is correlated and it contains FETCH FIRST 1 
ROW ONLY clause 
   $ db2 "create table t2 ( c1 int, c2 int) organize by column"; 
   $ db2 "insert into t1 values (1,1)" 
   $ db2 "insert into t1 values (1,1)" 
   $ db2 "insert into t2 values (1,1)" 
 
   $ db2 "update t2 u set c2 = ( select s.c2 from t1 s where 
s.c1 = u.c1 fetch first 1 row only )" 
   SQL0811N  The result of a scalar fullselect, SELECT INTO 
statement, or VALUES 
   INTO statement is more than one row.  SQLSTATE=21000
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* When the query or sub-select is used in a scalar context,    * 
* such as a scalar subquery, SELECT ... INTO, UPDATE ... SET.  * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 Cancun Release 10.5.0.4 (also known as Fix    * 
* Pack 4) or higher.                                           * 
****************************************************************
Local Fix:
available fix packs:
DB2 Cancun Release 10.5.0.4 (also known as Fix Pack 4) for Linux, UNIX, and Windows
DB2 Version 10.5 Fix Pack 9 for Linux, UNIX, and Windows

Solution
Fixed in DB2 Cancun Release 10.5.0.4 (also known as Fix Pack 40)
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
13.02.2014
15.09.2014
14.10.2014
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
10.5.0.4 FixList