I am using a table on a Postgres DB. I have a table with the following columns:
ID
STATE
LOB
CREATED TIMESTAMP
SUBMISSION NUMBER
SUBMISSION AMOUNT
This table is being updated by 2 different insert queries:
- One where we receive the value of SUBMISSION NUMBER in the insert query
- 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
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?