http://www.perlmonks.org?node_id=657586


in reply to Pretty printing the exact query (with bind variables) executed by DBI?

Part of the problem is that DBI deos not ever interpolate the binds into the SQL and most (all?) DBDs likewise pass along the SQL and bind values separately to the RDBMS. The best you can do is simulate it as I show in Interpolate binds into SQL on error - DBI subclassing. That should show you how to "assemble" the statement and where you can format it as you desire.