I'm trying to understand the proof of the following theorem in Shafarevich's Basic Algebraic Geometry I, Chap 2.3.1:
I'm trying to follow the indication of the proof, but I'm still stuck.
Here's my attempt: take an element $u\in k[X]$ which is zero on $Y$ but not zero on $X$ (this is possible because $Y\subsetneq X$). In particular $u\in\mathfrak{a}_{Y,x}\subset\mathcal{O}_x$, where:
$$\mathfrak{a}_{Y,x}:=\{f\in\mathcal{O}_x\mid f|_{U\cap Y}=0 \text{ for some neighbourhood }U\ni x\}$$
Since $\mathcal{O}_x$ is a UFD, there is $v\in\mathcal{O}_x$ irreducible which divides $u$ in $\mathcal{O}_x$. Let $U$ be the domain of definition of $v$ (by definition of $v$, $x\in U$). I'm trying to prove that $\mathfrak{a}_{U\cap Y}=(h)\subset k[U]$.
Maybe I could do this by proving $\mathfrak{a}_{Y,x}=h\mathcal{O}_x$ and therefore $\mathfrak{a}_{U\cap Y}=\mathfrak{a}_{Y,x}\cap k[U]=(h)$. But I don't know how to prove that (or even if this is true).

One can start with $O_{,}$, and a local equation $h$, then "spread it out" over its open neighborhood. In the local ring $_{,}$, $_{,}$ is defined by a single equation as all codimension 1 prime ideal in a UFD is principal.