I used the IBM Migration Toolkit 2.0 to convert an MSSQL database schema to DB2 9.7. When I converted MSSQL stored procedures I recognized two issues, and I don't understand why the toolkit inserted some code parts.
All stored procedure has the following code:
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE l_error CHAR(5) DEFAULT '00000';
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET l_error = '00000';
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING
SET l_error = SQLSTATE;
IF SUBSTR(l_error, 1, 1) >= '5'
AND SUBSTR(l_error, 1, 1) <= '9' THEN
This code part is really necessary?
The other interesting issue is:
The tool uses a COMMIT; statement after _each_ update and insert statement in the stored procedure. If I remove these COMMIT; statements the procedures are still working fine, so I don't understand why these statements are necessary? (the original MSSQL code did not contain these COMMIT statements)