How do I find a confidence interval for rate defective from my sample taken without replacement? I have a population of let's say 10000 discrete data points. I want to assess this population on a certain parameter (let's say error rate) based on a sample. I don't want to check the error rate on the entire population. I want to calculate this error rate on a sample only.
How do I decide if a 10% sample is enough or 20% sample is enough or 30% sample is enough?

The proportion (10%, 20%, 30%, etc.) you need to take
depends on how closely you need to approximate the
defective rate.
For example, suppose the population size is 10,000 with
$d = 0.13$ defective (that is, 1300 defective and 8700 good). Then you sample 10% (1000). obtaining 1000 estimates $\hat d_{.10}$ of the defective rate. Because
of the large sample sizes the estimates will be nearly
normally distributed, so we can get an idea of the
length of the CI $(0.1294, 0.1306)$ with the usual normal formula.
The exact computations can be found using the
mean and variance of the appropriate hypergeometric
distribution. I used a simulation below:
set.seed(1234)
m = 10^6;  N = 10^4; d = .13
d.10 = rhyper(m, N*d, N*(1-d), N*.1)/(N*.1)
mean(d.10)+ qnorm(c(.025,.975))*sd(d.10)/sqrt(N*.1)
[1] 0.1293771 0.1306276

For a 30% sample (of size 3000), we get a slightly shorter CI $(0.1299, 0.1301).$
d.30 = rhyper(m, N*d, N*(1-d), N*.3)/(N*.3)
mean(d.30)+ qnorm(c(.025,.975))*sd(d.30)/sqrt(N*.3)
[1] 0.1298128 0.1301805

You should probably explore several larger and smaller defective rates.
