Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Should/Can I use Sequence for this ?
Hi,
Thanks for the reply.
OK, for table-based solution
> the app would increment the value in the department row (which unfortunately > serialized transactions at the department level)
Is the serializable by default ?
Or what command should I use to make sure that no two document use same sequence
number ?
Thank you,
tanto
"Mark C. Stock" <mcstockX_at_Xenquery .com> wrote in message news:<bZidnV_CVpSRgMXcRVn-hA_at_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 - 22:11:51 CDT