title: Set a column value based on a condition
body: <p>I am using a table on a Postgres DB. I have a table with the following columns:</p>
  <pre><code>ID
  STATE
  LOB
  CREATED TIMESTAMP
  SUBMISSION NUMBER
  SUBMISSION AMOUNT
  </code></pre>
  <p>This table is being updated by 2 different insert queries:</p>
  <ol>
  <li>One where we receive the value of SUBMISSION NUMBER in the insert query</li>
  <li>One where we do not receive the value of SUBMISSION NUMBER in the insert query. In this case the value of SUBMISSION NUMBER needs to be incremented by 1 based on the last available value of the column</li>
  </ol>
  <p>This would not work if I have an auto incremented column of SUBMISSION NUMBER.
  If I do not have an auto incremented column, then would I create a sequence to do this? Or would I develop a function to do this? What's the best way one could achieve this?</p>