Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Should/Can I use Sequence for this ?
xtanto wrote:
> Hi Gurus,
>
> I have to maintain computer generated document numbering where the
> number format is :
>
> xx123456789
>
> xx : is the department code
> 123456789 : document number counter per department
>
> How can I maintain this number ?
> Can I use sequence for this ? or should I manually maintain(increment)
> it in a document highest number table per dept code ?
>
> Thank you for your help,
> xtanto
As Jim says a sequence is perfect for it ... but with one caveat. Your design violates the most basic rules of data normalization. The 'xx' department code belongs in a column of its own.
In addition to just adhering to the normalization rule you will find that every query you do doesn't include SUBSTR(doc_id, 1, 2) which will improve performance and scalability.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Sun Sep 26 2004 - 14:23:51 CDT