Suppose we have
$$dB_t = r_tB_tdt$$ and we have further that $r_t$ is a deterministic function of time $t$. I know that this is simply an ODE with separable variables that has standard solution in $[t,T]$: $$B_T = B_te^{\int_{t}^{T}r_sds} $$
but what if $r_t$ is stochastic? For example it could be
$$dr_t = \mu r_tdt + \sigma r_tdW_t$$
where $W_t$ is the Brownian motion.
Then $B_t$ itself is stochastic and how can I integrate something like
$$\int_{t}^{T}\frac{dB_t}{B_t}$$ Isn't this a stochastic integral? I am having hard times figuring out why in this case the solution is the same as when $r_t$ is deterministic.
Thank you very much for your help
It is still not a stochastic differential equation, since it does not have any stochastic part like
$$\mathrm{d} B_t=r_t B_t \, \mathrm{d}t+v_t B_t \, \mathrm{d} W_t.$$
Use the Itô-formula on $f(B_t)=\ln(B_t)$ to derive the following formula
$$\displaystyle \ln(B_t)=\ln(B_0)+\int_{0}^{t} \frac{1}{B_s}\, \mathrm{d}B_s+\frac{1}{2}\cdot \int_{0}^{t} -\frac{1}{B^2_s} \, \mathrm{d}\langle B \rangle_s.$$
Where $\langle B \rangle$ is the quadratic variation of $B$ which satisfies $\mathrm{d}\langle B \rangle_t=v^2_t B^2_t \, \mathrm{d}t$. Substituate this to the above formula.
$$\displaystyle \ln(B_t)=\ln(B_0)+\int_{0}^{t} \frac{1}{B_s}\, \mathrm{d}B_s-\frac{1}{2}\cdot \int_{0}^{t} v^2_s \, \mathrm{d}s.$$
From here it is quite obvious, that
$$\displaystyle \int_{0}^{t} \frac{1}{B_s}\, \mathrm{d}B_s=\ln(B_t)-\ln(B_0)+\frac{1}{2}\cdot \int_{0}^{t} v^2_s \, \mathrm{d}s.$$
In your case $v_t=0$ and that is the reason why you have observed that the solution of your equation matches with the solution of the ODE, since it does not have any part of stochastic integration only Lebesgue integration applied to a stochastic variable, but there is not any integral which includes stochastic integrator process. You can substitute now $\mathrm{d} B_t=r_t B_t \, \mathrm{d}t$
$$\displaystyle \ln(B_t)-\ln(B_0)+\frac{1}{2}\cdot \int_{0}^{t} v^2_s \, \mathrm{d}s=\int_{0}^{t} \frac{1}{B_s}\, \mathrm{d}B_s= \int_{0}^{t} r_s\, \mathrm{d}s.$$
$$\displaystyle \ln(B_t)=\ln(B_0)+\int_{0}^{t} r_s\, \mathrm{d}s-\frac{1}{2}\cdot \int_{0}^{t} v^2_s \, \mathrm{d}s.$$
$$B_t=B_0\cdot \mathrm{e}^{\ \displaystyle \int_{0}^{t}r_s \, \mathrm{d}s -\frac{1}{2}\cdot \int_{0}^{t} v^2_s \, \mathrm{d}s}$$
If one assumes that $v_t=0$ that leads to the above mentioned formula you had.
$$B_t=B_0\cdot \mathrm{e}^{\ \displaystyle \int_{0}^{t}r_s \, \mathrm{d}s}.$$