home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Neueste VersionenFixList
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
Haben Sie Probleme? - Kontaktieren Sie uns.
Kostenlos registrieren anmeldung-x26
Kontaktformular kontakt-x26

DB2 - Problembeschreibung

Problem IC79279 Status: Geschlossen

SQL0151N or SQL0206N MAY RESULT WHEN CREATING SQL PROCEDURE CONTAINING
TRUNCATE STATEMENT

Produkt:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problembeschreibung:
Various errors, such as SQL0151N and SQL0206N, may occur when 
creating a SQL procedure that contains a TRUNCATE statement. 
The following steps illustrate such a scenario: 
. 
1. Create a table and its alias. 
$ db2 "create table S1.T1 (C1 int)" 
$ db2 "create alias S2.T1 for table S1.T1" 
 
2. Create a SQL procedure with TRUNCATE statement. 
p1.sql 
------------------------------ 
CREATE OR REPLACE PROCEDURE P1() 
BEGIN 
TRUNCATE TABLE S2.T1 IMMEDIATE; 
INSERT INTO S2.T1 VALUES 1; 
END@ 
------------------------------ 
$ db2 -td@ -vf p1.sql 
SQL0151N  The column "C1" cannot be updated.  LINE NUMBER=4. 
SQLSTATE=42808 
 
p2.sql 
------------------------------ 
CREATE OR REPLACE PROCEDURE P2() 
BEGIN 
TRUNCATE TABLE S2.T1 IMMEDIATE; 
INSERT INTO S1.T1 VALUES 1; 
END@ 
------------------------------ 
$ db2 -td@ -vf p2.sql 
SQL0206N  "C1" is not valid in the context where it is used. 
LINE NUMBER=4. 
SQLSTATE=42703
Problem-Zusammenfassung:
**************************************************************** 
* USERS AFFECTED:                                              * 
* Users who use TRUNCATE statement in a SQL procedure.         * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* Various errors, such as SQL0151N and SQL0206N, may occur     * 
* when                                                         * 
* creating a SQL procedure that contains a TRUNCATE statement. * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Please upgrade to V9.7 FixPack 6 or later.                   * 
****************************************************************
Local-Fix:
Replace the alias in the TRUNCATE statement with the base table 
OR 
Substitute the TRUNCATE statement with the DELETE statement
verfügbare FixPacks:
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Lösung
This problem is first Fixed in DB2 V9.7 FixPack 6.
Workaround
keiner bekannt / siehe Local-Fix
Bug-Verfolgung
Vorgänger  : APAR is sysrouted TO one or more of the following: IC84358 
Nachfolger : 
Weitere Daten
Datum - Problem gemeldet    :
Datum - Problem geschlossen :
Datum - der letzten Änderung:
19.10.2011
11.06.2012
11.06.2012
Problem behoben ab folgender Versionen (IBM BugInfos)
9.7.FP6
Problem behoben lt. FixList in der Version
9.7.0.6 FixList