Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Should/Can I use Sequence for this ?

Re: Should/Can I use Sequence for this ?

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Mon, 27 Sep 2004 10:00:11 -0400
Message-ID: <bZidnV_CVpSRgMXcRVn-hA@comcast.com>

"xtanto" <krislioe_at_gmail.com> wrote in message news:e1c9bd55.0409270540.104601d3_at_posting.google.com...
| Hi,
| Each department has its own counter.
| e.g :
| 0100001
| 0100002
| 0200001
| 0200002
| How can I do it with sequence.
|
| Thank you,
| xtanto
|

you'd need one sequence per department, and then your code would have to choose which sequence based on the department, plus create a sequence on the fly for each new department -- plus it looks like you need sequential numbers with no gaps, and sequences cannot guarantee 'no gaps'

you'll need a table-based solution, perhaps just keeping the current (or next) counter value in the department row... then as a new department-specific sequence number is needed, the app would increment the value in the department row (which unfortunately serialized transactions at the department level) and use the calculated value for the new sequence. note that simply choosing the current max number from the target table (i believe you said it was for document numbers) would not guarantee uniqueness, as concurrent transactions could select the same max, and thus attempt to assign the same new document number

++ mcs Received on Mon Sep 27 2004 - 09:00:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US