First of all, it helps to understand what he has said about being moral. Here are a few examples from the play, of his moral beliefs. He finds his mother's actions despicable, and bordering on incestuous. So, it is immoral to get married quickly after a spouse dies. Then, he extends that to all women. All women are immoral and fickle. He also broods over his uncle's lack of morality, calling him a monster. He has a strong sense of heaven and hell; he won't kill his uncle while he's praying, because then he might go to heaven, not hell. He himself doesn't want to kill his uncle without being assured that he is guilty; he doesn't want to commit murder lightly, so that reflects a certain morality.
Hamlet's morality often keeps him from acting; it makes him mull around in his uncertainty and angst, instead of just acting. If he wasn't so morally concerned about heaven and hell, he could just go kill his uncle, at any time, without fear of repercussions. If he wasn't so morally concerned about proper behavior in women, he wouldn't be so angry about his mother, leading to his rejection of Ophelia. His morality contributes to keeping him angry and inactive throughout the entire play. He is just full of words and haughty sentiments, but when it comes to putting his actions where his words are, he often backs down, attributing it to morals. Is it morals, or cowardice? I hope that those thoughts help a bit; good luck with the question!