Wrap function with set clause