Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Alphanumeric sequence 0001 to ZZZZ (not base 36)

IniyavanJul 1 2015 — edited Jul 1 2015

Hi friends,

I need to create 4-digit sequence numners from 0001 to ZZZZ. It sould be

0001

0002

0003

....

9999

A000

A001

A002

....

A999

B000

B001

B002

....

Z999

AA00

AA01

AA02

....

AA99

AB00

AB01

....

AZ99

AAA1

....

ZZZZ

I have referred many threads and other forums, AskTom, Tkyte, etc. But I haven't got the answer. Most of the answers are Base 36. But my requirement is decimal based.

If the input is "1" then the output should be "0001"; input "999", output "0999"; input "9999", output "9999"; input "10000", output "A000"; input 10001, output "A0001"; and so on.

Thanks in advance.

This post has been answered by Chris Hunt on Jul 1 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 29 2015
Added on Jul 1 2015
15 comments
5,494 views