Can't you just examine $sth->{Statement}? See Statement
In reply to Re^3: DBI - check erroneous statement? by mje in thread DBI - check erroneous statement? by DreamT