Sequences
One of the big problems that occurs in a multiuser database is the difficulty of supplying
unique numbers for use as keys or identifiers. For this situation, Oracle allows
youto create an object called a sequence. The sequence object is fairly simple. Whenever
anyone requests a value from it, it returns a value and increments its internal
value, avoiding contention and time-consuming interaction with the requesting
application. Oracle can cache a range of numbers for the sequence so that access to
the next number doesn??™t have to involve disk I/O??”the requests can be satisfied from
the range in the SGA.
Sequence numbers are defined with a name, an incremental value, and some additional
information about the sequence. Sequences exist independently of any particular table,
so more than one table can use the same sequence number.
Consider what might happen if you didn??™t use Oracle sequences. You might store the
last sequence number used in a column in a table. A user who wanted to get the next
sequence number would read the last number, increment it by a fixed value, and
write the new value back to the column.
Pages:
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231