title: SQL (oracle): is there an equivalent to substr for numeric fields?
body: <p>To retrieve characters between position X and Y <em>from a string</em> in oracle sql I can</p>
  
  <pre><code>substr(string_var, X, Y)
  </code></pre>
  
  <p>What if I need to get the digits from a number between position X and Y?  (i.e. if I want the third and fourth digits in the number 123456 = 34)</p>
  
  <p>I know I can</p>
  
  <pre><code>substr(to_char(numeric_var), X, Y)
  </code></pre>
  
  <p>But what if I need the output to be treated as a number? Do I have to do</p>
  
  <pre><code>to_number(substr(to_char(numeric_var), X, Y))
  </code></pre>
  
  <p>Or is there an equivalent to substr for numeric fields?</p>