Is there a way to use \ref{} inside the test part of \ifnum. The following example runs into an error.
\documentclass{article}
\begin{document}
\begin{table}
\caption{ex}
\label{tab:ex}
\end{table}
\def\a{\ref{tab:ex}}
\ifnum\a>0 y\else n\fi
\end{document}