Sequence is the best choice?? [message #151066] |
Mon, 12 December 2005 23:49 |
Scarlet.Zhu
Messages: 22 Registered: December 2005 Location: Shanghai
|
Junior Member |
|
|
It is always suggested that sequence is applied for its easy use. However, it causes waste if insert,update,create is on failure. That is, seq.getnextval() executes, but it never rolls back. Don't you think that getting the maximum value of a column and increasing it by a specific interval value is a better approach??
Scarlet
[Updated on: Mon, 12 December 2005 23:50] Report message to a moderator
|
|
|
|
Re: Sequence is the best choice?? [message #151221 is a reply to message #151066] |
Tue, 13 December 2005 17:19 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
If you are 'showing' the number to user and they DEMAND that they be in sequence then use the MAX+1 method but do it in the database trigger, not in your form. That way, if the user decides NOT to save the record you haven't 'burned' an entry.
If the user doesn't see the number then why worry. If you want them to be almost seqential then when you define the sequence use NOCACHE so that the numbers are 'created' sequential. If you have a hi-speed data source that needs sequences then you really should specify a CACHE value of an appropriate number.
David
|
|
|