title: How to verify Oracle sequences
body: <p>We have a customer who does {something}, and after that some of our sequences are returning numbers that have already been used.  While the long term answer would be for them to stop doing {something}, I need a simple way to check the sequences against the tables they are used in.</p>
  
  <p>I can query <code>user_sequences</code> to get the <code>last_number</code> for each sequence and I can get the <code>max(id_number)</code> for each table.  But when I try to do both in the same query I get nulls back.</p>
  
  <p>My broken SQL is:</p>
  
  <pre class="lang-sql prettyprint-override"><code>select max(last_number) , max(id_number) from user_sequences,
  squiggly.ACCOUNT_CODE_DEFINITION where sequence_name = 'ACCOUNT_CODE_DEFINITION_SEQ' 
  and sequence_owner = 'SQUIGGLY' ;
  </code></pre>