Let $K$ be an arbitrary number field and $\mathcal{O}_K$ its ring of integers.
I have seen many concrete examples about finding prime elements. For example I calculated the prime elements of $\mathbb{Z}[i]$, or $\mathbb{Z}[\sqrt{-2}]$.
But how does this works in general? Exist an algorithm, which finds (some of) the prime elements of $\mathcal{O}_K$? Moreover does every ring of integers of a number field contains at least one prime element?
Additionally what happens if I consider function fields instead of number fields?