Formation of oximes and hydrazones