Hi Edwin,
You can use very simple solution:
Create sequence s1 maxvalue 999;
And in your application or sql script, use the below command:
select lpad(s1.nextval,3,'0') from dual;
Regards,
Mohit Singla, Valu America Inc.,113 Technology Drive,Pittsburgh, PA, 15275
Tel: - 412-494-0400 Ext. 8107
-----Original Message-----
From: Edwin Uy
[mailto:oracledba-ezmlmshield-x17102285.[Email address protected]
Sent: Wednesday, August 04, 2004 6:49 AM
To: LazyDBA Discussion
Subject: PADDING IDENTITY COLUMNS/SEQUENCE NUMBERS with ZEROES
Hi all,
Is this at all possible or is this a stupid requirement? 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. Wait a minute, did I just answer my own question
there?
Cheers,
EDWIN ONG UY
\\|//
(o o)
^"^"^"^"^"^oOOo"^(_)^"oOOo^"^"^"^"^"^"^"^"^"^"^
"Choose a job you love, and you will never have to work a day in your
life." --Confucius
"How do I work? I grope." -- Albert Einstein
"Experience is the best teacher, enrolling in the class is the biggest
problem." -- Anonymous
--------
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