Consider using sequences instead and remove the logic to see if a contact already exists (aka checking to make SURE it is unique. It will always be unique unless you have rogue programs out there not using the sequence object)
CREATE SEQUENCE seq_contact
START WITH 1
INCREMENT BY 1
INSERT INTO Contact (P_Id,FirstName,LastName)
From: Stone, Joel [mailto:Joel.Stone@xxxxxxxxxx]
Sent: Thursday, March 13, 2014 3:48 PM
Subject: is there a proper method to get next number in sequence?
Contracts are added to our database by going to a dataara and retrieving the next contract number.
This next contract number is used to add the new contract record. (contract number is primary unique key).
It is possible that contract numbers already exist sporadically, so somewhere in the logic the contract file must be checked for key existence.
Is it OK to find the next contract # during the contract add? I would think that this would be risky and it may be better to simply bump the data area by 1 and then wait and validate it is unique whenever the NEXT user tries to add a contact.
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit http://www.symanteccloud.com
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l