DB2 Version 10.1 for Linux, UNIX, and Windows

FP2: Error locating in SQLCA expanded

In DB2® Version 10.1 Fix Pack 2 and later fix packs, when an SQL PL or PL/SQL runtime error is reported, the SQLCA that represents the error contains an object ID and a line number that identify where the error originated.

The DB2 database manager currently provides line number information in the SQLCA for SQL PL and PL/SQL compile-time errors. When there are compile-time errors the character in sqlcaid(6) is 'L' and sqlerrd(3) contains the line number reported by the SQL compiler. In the new runtime error locating support, when the character in sqlcaid(6) is 'M', then sqlerrd(3) contains the line number of the statement that raised the error and sqlerrd(4) contains the object ID that identifies the SQL PL or PL/SQL object where the error was raised.

A new procedure that is called GET_ROUTINE_NAME can be used to map the unique identifier to the name of the object that raised the error. This procedure takes as input parameter the value in the sqlerrd(4) field and returns information about the object that raised the error.