Debugging of SQL statement