Question

Booz Allen Hamilton
US
Last activity: 30 Sep 2019 12:38 EDT
Create Unique IDs in a given table
We have a concrete Pega table which we would like to generate unique values (for insert). Currently we have imported the records from an excel spreadsheet; however, if we are to allow the customer to add records themselves, we will need to generated new unique keys/ids.
For example, we have an organization table; which has ORG_ID as the primary key. If we want the user to add a new Organization, how do we generate the new key? Ideally, we would like to make a call to get the next sequence (specific to the Organization table). If the last record in the Organization table has an ORG_ID of 1100, then we want the next record generated to be 1101 (and so on).
I realize that we can query the entire Organziation table for the max(ORG_ID); however, that seems very inefficient. Is there an easier way to generate the new unique sequence ID?