Weil divisors fail over singular varieties Let be $k$ an algebraically closed field. We know that if $X$ is an irreducibile, normal variety, one can associate to every rational function $(f)\in k(X)^*$ a Weil principal divisor $$(f)=\sum_{Y} \nu_Y Y$$ where $Y$ varies among prime divisors of $X$ and $\nu_Y $ is the valutation morphism associated to the ring $\mathscr{O}_{X,Y}$. 
As the theory of Weil divisors is developed over normal or locally factorial varieties, I wonder if there is an example where this correspondence fails. 

Does anyone have an hint for a counter-example of rational function
  over a singular variety that can't be associated to a Weil divisor
  over $X$?

 A: For any varieties over any field, you can associate the group of Weil divisor, that is the free abelian group generated by the codimension 1 irreductible subvarieties. It is denoted $Z^1(X)$. Now, if $f$ is a rational function and $V$ a subvariety of codimension 1, there are many ways to define the order of $f=a/b$ along $V$, some of them work only under some assumptions. Let $A=\mathcal{O}_{X,V}$ be the local ring at the generic point of $V$, then


*

*if $A$ is discrete valuation ring, then we can define $\mathrm{ord}_V(f)$ to be the valuation of $f$.

*if $V$ is a point in a curve over an algebraically closed field $K$, we can define $\mathrm{ord}_V(f)$ to be the difference $\dim_K A/(a)-\dim_K A/(b)$.

*for general $V$, we can define $\mathrm{ord}_V(f)$ to be the difference $\mathrm{lg}_A A/(a)-\mathrm{lg}_A A/(b)$, where $\mathrm{lg}_A(M)$ is the length of the $A$-module $M$.


When several of theses definitions make sense, they agree. The last one always work however. You can also show that the first definition determines the third using normalization.
There is also a notion of Cartier divisors, which form the group $\mathrm{Div}(X)$. There is always a map $\mathrm{Div}(X)\rightarrow Z^1(X)$. One can show that if $X$ is integral and normal, then this is injective. Moreover, it is an isomorphism if and only if the local rings of $X$ are unique factorization domain.
