@halogirl
Are you talking of wet Dreams?
A friend of mine was feeling embarrassed even to confess it, to a priest .but the priest gave a wounder advice ,he said if it happens in our sub-conscious mind while we are asleep,its not a sin,since we are not conscious,if we are conscious then its a sin( to sin we are to be conscious) .and if we are semi-conscious, but not full consent to sin, you can make your own judgement on this, pray and take the decision with a good conscience.asking Jesus to forgive you trusting in his mercy, we can receive Holy Communion,but if you feel you sinned while in sub-conscious mind, then don’t receive Holy communion,so our conscience won’t prick us or hurt or have any guilty feeling.Therefore if you keep thinking lustful thoughts before sleeping more or less you’ll end up in wet dreams,lust is one of the 7 most deadly sins.
There is a verse in the bible which mentions it
Jude 1:8 Yet in the same way these dreamers also defile the flesh, reject authority, and slander the glorious ones.
Sirach 34:5 Divinations and omens and dreams are unreal,and like a woman in labor, the mind has fantasies.6 Unless they are sent by intervention from the Most High,pay no attention to them.