  Let $Y_{1}, \ldots, Y_{q}$ be closed subschemes which are located in
$\ell$-subgeneral position with index $\kappa$ in a complex projective variety
$X$ of dimension $n.$ Let $A$ be an ample Cartier divisor on $X.$ We obtain
that if a holomorphic curve $f:\mathbb C \to X$ is Zariski-dense, then for
every $\epsilon >0,$ \begin{eqnarray*}
\sum^{q}_{j=1}\epsilon_{Y_{j}}(A)m_{f}(r,Y_{j})\leq_{exc}
\left(\frac{(\ell-n+\kappa)(n+1)}{\kappa}+\epsilon\right)T_{f,A}(r).
\end{eqnarray*}This generalizes the second main theorems for general position
case due to Heier-Levin [AM J. Math. 143(2021), no. 1, 213-226] and subgeneral
position case due to He-Ru [J. Number Theory 229(2021), 125-141]. In
particular, whenever all the $Y_j$ are reduced to Cartier divisors, we also
give a second main theorem with the distributive constant. The corresponding
Schmidt's subspace theorem for closed subschemes in Diophantine approximation
is also given.
