DB2 - Problembeschreibung
Problem IC63100 | Status: Geschlossen |
DBMS_SQL.Parse does not execute TRUNCATE sql statement | |
Produkt: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problembeschreibung: | |
If the SQL command is a DDL command, it is immediately executed and does not require running the EXECUTE procedure. This does not work for TRUNCATE sql statement. This APAR fixes this issue. For example, we have following statements in a stored procedure: ----------------------------------------------- curid := DBMS_SQL.OPEN_CURSOR; statement := 'TRUNCATE TABLE tab_name'; DBMS_SQL.Parse(curid, statement, DBMS_SQL.native); DBMS_SQL.CLOSE_CURSOR(curid); ----------------------------------------------- After executing these statement, we will find that the table did not get truncated. | |
Problem-Zusammenfassung: | |
**************************************************************** * USERS AFFECTED: * * All. * **************************************************************** * PROBLEM DESCRIPTION: * * If the SQL command is a DDL command, it is immediately * * executed * * and does not require running the EXECUTE procedure. * * * * This does not work for TRUNCATE sql statement. * * * * This APAR fixes this issue. * * * * * * * * For example, we have following statements in a stored * * procedure: * * ----------------------------------------------- * * * * curid := DBMS_SQL.OPEN_CURSOR; * * * * statement := 'TRUNCATE TABLE tab_name'; * * * * DBMS_SQL.Parse(curid, statement, DBMS_SQL.native); * * * * DBMS_SQL.CLOSE_CURSOR(curid); * * * * ----------------------------------------------- * * * * * * * * After executing these statement, we will find that the table * * did * * not get truncated. * **************************************************************** * RECOMMENDATION: * * Upgrade to version 9.7 fixpack 1 or later. * **************************************************************** | |
Local-Fix: | |
As a workaround you can include the DBMS_SQL.Execute(curid) as follows, so that the table can really get truncated. -------------------------------------------- curid := DBMS_SQL.OPEN_CURSOR; statement := 'TRUNCATE TABLE tab_name'; DBMS_SQL.Parse ( curid, statement, DBMS_SQL.native); v_status := DBMS_SQL.Execute (curid); DBMS_SQL.CLOSE_CURSOR(curid); -------------------------------------------- | |
verfügbare FixPacks: | |
DB2 Version 9.7 Fix Pack 1 for Linux, UNIX, and Windows | |
Lösung | |
This problem is first fixed in version 9.7 fixpack 1. | |
Workaround | |
keiner bekannt / siehe Local-Fix | |
Weitere Daten | |
Datum - Problem gemeldet : Datum - Problem geschlossen : Datum - der letzten Änderung: | 10.09.2009 22.12.2009 22.12.2009 |
Problem behoben ab folgender Versionen (IBM BugInfos) | |
9.7.FP1 | |
Problem behoben lt. FixList in der Version | |
9.7.0.1 |