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: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Sun, 26 Sep 2004 12:23:51 -0700
Message-ID: <1096226709.145021@yasure>


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

Original text of this message

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