Depending on the number of transaction U have in the system U can use a
trigger on a char(3) column translate to num. to make the calculation work
and insert as a char.
Roni
-------Original Message-------
From: mAsterdam
Date: 08/04/04 15:42:35
To: LazyDBA Discussion
Subject: Re: PADDING IDENTITY COLUMNS/SEQUENCE NUMBERS with ZEROES
Hi,
Edwin Uy wrote:
>Is this at all possible or is this a stupid requirement?
Yes :-)
>A customer wants to have a column that is to auto-generated, that is, DBAs
call
>them IDENTITY in MSSQL and SEQUENCE in Oracle or DB2 I guess? Well, the
>easy part is you can auto-generate the values, but customer wants them
>3-char long, that is, 001, 002. Is it possible to achieve this or do I
>just format the values as they are displayed on the FORM or as they are
>extracted from SQL.
Something like this?:
create table no_thousand_alike
(nta_key varchar2(4),
somedata varchar2(32));
create sequence nta_seq;
INSERT INTO no_thousand_alike
values (to_char (nta_seq.NEXTVAL,'009'), 'Da data');
INSERT INTO no_thousand_alike
values (to_char (nta_seq.NEXTVAL,'009'), 'Mo data');
INSERT INTO no_thousand_alike
values (to_char (nta_seq.NEXTVAL,'009'), 'Even mo');
INSERT INTO no_thousand_alike
values (to_char (nta_seq.NEXTVAL,'009'),'last data');
select * from no_thousand_alike;
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these terms:http://www.lazydba.com/legal
html
Oracle LazyDBA home page