A police officer could theoretically work an entire career without being put in a situation where he or she must do something immoral. Not all police activities are immoral, and many are moral. The act of swearing to uphold laws is not in itself an immoral act.
Just because police officers are not obligated to protect and serve does not mean that there are no "good" police officers. Officers can still protect and serve even though they are not obligated to. You have also not supported with evidence that protecting and serving is necessary for being a "good" police officer.
Wouldn't it be a better argument to say that a cop is amoral, except where he leaves the confines of his duties? It could be said that swearing to uphold these laws abdicates him of responsibility for their consequences, so long as he is not over- or under-zealous, and does not act outside them.