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)


INSERT INTO Contact (P_Id,FirstName,LastName)
VALUES (seq_contact.nextval,'Lars','Monsen')

-----Original Message-----
From: Stone, Joel [mailto:Joel.Stone@xxxxxxxxxx]
Sent: Thursday, March 13, 2014 3:48 PM
To: midrange-l@xxxxxxxxxxxx
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.

Any suggestions?


This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit ______________________________________________________________________
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

Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2015 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact