Monday, December 6, 2010

DB2:SQLPL: Weird look-ahead bug in SQLPL stored procedure SQL0811N

Just found interesting bug in DB2:

One of the update statements was failing with below SQL Error:

SQL0811N  The result of a scalar fullselect, SELECT INTO statement, or VALUES INTO statement is more than one row.  SQLSTATE=21000
Nothing unusual, outside of fact that this error was appearing in run time immediately after stored procedure started to execute.

Problem SQL was in the middle of stored procedure body, but it was a FIRST REAL SQL in the body (not call to other stored procedures).

The moral: DB2 executing look-ahead approach in stored procedures and when it finds "naked" SQL it will execute it, ignoring other statements (including debugging ones).

No comments:

Post a Comment