Using sequences or control tables
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Using sequences or control tables
Before Progress Version 7, the only way ABL could generate sequential values was to maintain integer fields in a table record created specifically for this purpose. This is often done in a control table, separate from all other application tables.
For example, you might have a control table named syscontrol
that contains the field last–cus–num. This field holds the value
of the CustNum field for the last Customer record.
The following code fragment generates a new Customer record
with a unique Customer number:
|
Note that access to the syscontrol table must be made within a small transaction to avoid lock contention problems.
Sequences provide a built-in means for generating incremental values, but they are not suitable for all applications. In certain situations (described in the following sections), you might need to use a control table, instead.
The following table compares sequences and control tables.
| Capability | Sequences | Control tables |
|---|---|---|
| Access speed | Fast | Slow |
| Transaction independent | Yes | No |
| Guaranteed order | Yes | No |
| Auto initializing | Yes | No |
| Auto cycling | Yes | No |
| Bounds checking | Yes | No |
| Database limit | 250 per 1K database block size | Field limit |