Fixed a type mismatch issue for SQL queries without parameters