Does there exist a function $f : I \to \mathbb{R}$ defined on an interval $I \subseteq \mathbb{R}$ that is measurable but not integrable on any compact subinterval $[a,b] \subseteq I$?
One can try to call for Lusin's continuity theorem: If $m$ denotes the Lebesgue measure then for each $\varepsilon > 0$ there exists a compact set $K_\varepsilon \subseteq I$ such that $m(I \setminus K_\varepsilon) < \varepsilon$ and $f|_{K_\varepsilon}$ is continuous. Now the question is whether for some $\varepsilon > 0$ the compact set $K_\varepsilon$ contains an interval or equivalently has non-empty interior.
In general, a compact subset of $[0,1]$ (or $\mathbb{R}$) can have both empty interior and positive Lebesgue measure and even more: for each $\varepsilon \in (0,1)$ the fat Cantor set is compact, has Lebesgue measure $\varepsilon$ and empty interior.