title: How to extract month number from date in Oracle
body: <p>I have <code>ID_BB_SECURITY</code> column where the date value is stored in this column for example <code>'20190801'</code>.</p>
  
  <p>I want to get month number from this field for example for August date i want to get 8.</p>
  
  <p>I tried below query but it throws an error 'literal does not match':</p>
  
  <pre><code>select to_number(to_date(ID_BB_SECURITY),'mm') from BT_EXPORT
  </code></pre>
  
  <p>I am not sure if i have to ignore null values so as to avoid the error</p>