Improve company productivity with a Business Account.Sign Up


alphabetic sequence generation in oracle

Posted on 2008-10-15
Medium Priority
Last Modified: 2013-12-07
I need unique alphabeticals sequence generation for about 5000 in oracle, how do I do that
Question by:reddi_mk
  • 4
  • 2
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22725269
could you please clarify the request?

Author Comment

ID: 22725431
I need to generate unique alphabeticals like A B C...Z , AA AB AB...AZ, BA,BB,BC...BZ  up to 5 characters
Could you please send me the script for this.

Author Comment

ID: 22725454
I need this in pl/sql script.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Author Comment

ID: 22725746
i had following script can somebody tweak it.

v_Current_Number number;
v_Current_Mod_Value number;
v_Current_Quot_Value number;
v_third_char varchar2(200);
v_second_char varchar2(200);
v_first_char varchar2(200);
v_Final_String varchar2(200);
select CINXFER.Testseq.nextval into v_Current_Number from dual;
v_Current_Mod_Value := mod(v_Current_Number, 26);
v_Current_Quot_Value := trunc(v_Current_Number/26);
select chr(64+ decode(v_Current_Mod_Value, 0, 26, v_Current_Mod_Value)) into v_third_char from dual;
dbms_output.put_line('third_char '||v_third_char);
select decode(v_Current_Quot_Value, 0, NULL,chr(64+ decode(mod(v_Current_Quot_Value, 26), 0, 26, mod(v_Current_Quot_Value, 26)))) into v_second_char from dual;
select decode(trunc(v_Current_Number/(26*26)), 0, NULL, chr(64+ decode(mod(trunc(v_Current_Number/(26*26)), 26), 0, 26, mod(trunc(v_Current_Number/(26*26)), 26)))) into v_first_char from dual;
v_Final_String := v_first_char||v_second_char||v_third_char;

Open in new window


Author Comment

ID: 22725963
Can somebody help me I need to get this done by end of today.

Accepted Solution

DiscoNova earned 1000 total points
ID: 22727039
So, basically you're looking for a Base10 to Base26 conversion function? offers a few possible solutions.

Expert Comment

ID: 22733823
i strongly object the fact that users have, during the last couple of months, started to abuse EE's "request removal"-option instead of awarding points to the people responding to their questions.

The page I linked to gives not only one, but a multitude of distinct possibilities of solving the problem. All the author needed to do is choose the one that suits him best.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
An introductory discussion about Oracle Analytic Functions which are used to calculate or compute Aggregate values, based on a group of rows.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question