Solved

alphabetic sequence generation in oracle

Posted on 2008-10-15
7
1,616 Views
Last Modified: 2013-12-07
I need unique alphabeticals sequence generation for about 5000 in oracle, how do I do that
0
Comment
Question by:reddi_mk
  • 4
  • 2
7 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
could you please clarify the request?
0
 

Author Comment

by:reddi_mk
Comment Utility
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.
0
 

Author Comment

by:reddi_mk
Comment Utility
I need this in pl/sql script.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:reddi_mk
Comment Utility
i had following script can somebody tweak it.


declare

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);

     begin

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;

end;

Open in new window

0
 

Author Comment

by:reddi_mk
Comment Utility
Can somebody help me I need to get this done by end of today.
0
 
LVL 7

Accepted Solution

by:
DiscoNova earned 250 total points
Comment Utility
So, basically you're looking for a Base10 to Base26 conversion function?

http://www.orafaq.com/forum/t/96699/2/ offers a few possible solutions.
0
 
LVL 7

Expert Comment

by:DiscoNova
Comment Utility
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.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to take different types of Oracle backups using RMAN.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now