How to generate the alphanumeric sequence under oracle

Hi Experts,

I need to create a primary key as below,

Its should start from a001, a002... a100 after reaching 100 the next value in the sequence must begin by b001... b100, like wise the sequence should go through until summer z001 alphabet... z100.

Please let me know for any information.

Kind regards

Millar

This will generate the a1 - a100, b1 - b100,... z1 - z100, aa1 - aa100, ab1 - ab100,... az1 - az100,...

SEQUENCE of s FALL

/

CREATE SEQUENCE s

/

CREATE OR REPLACE

FUNCTION get_s_nextval

RETURN VARCHAR2

IS

number of v_nextval;

number of v_alpha;

number of v_number;

v_base26 varchar2 (100);

BEGIN

v_nextval: = s.nextval;

v_number: = MOD(v_nextval,100) CASE

WHEN 0 THEN 100

Of OTHER MOD(v_nextval,100)

END;

v_alpha: = CEIL(v_nextval / 100) - 1;

v_base26: = NULL;

LOOP

v_base26: = CHR (ASCII ('a') + MOD(v_alpha,26)) | v_base26;

EXIT WHEN v_alpha<>

v_alpha: = TRUNC(v_alpha / 26) - 1;

END LOOP;

RETURN v_base26 | LPAD (v_number, 3, '0');

END;

/

WITH t AS)

SELECT s get_s_nextval,

level lvl

OF the double

CONNECT BY level<=>

)

SELECT s

T

WHERE MOD(lvl,100)<=>

ORDER BY lvl

/

S
------------------
A001
A100
B001
B100
C001
C100
D001
D100
E001
E100
F001

S
------------------
F100
G001
G100
H001
H100
I001
i100
J001
J100

20 selected lines.

SQL >

SY.

Tags: Database

Similar Questions

  • How to generate the tag xml from oracle pl/sql

    Hi all

    I have my db is version 10.2.0.3.0 - Production

    I tried a few examples

    The first is xmlgen.getXml like that

    SELECT dbms.xmlgen.getXml)
    ' SELECT order_number "EMP_NO".
    , header_id 'NAME '.
    , org_id "DEPT_NO.
    Of oe_order_headers_all
    WHERE header_id = 39441'
    ) OF THE double;


    but I think xmlgen.getXm is not a valid identifier

    Secondly, I tried like this

    SELECT e.employee_id,
    XMLELEMENT ("Emp", e.first_name |) » '|| Select) AS 'RESULT '.
    OF e hr.employees



    but the expected production is like that

    1001 < Emp > John 6000 < / Emp >


    but I'm getting

    10 (ORAXML)

    Someone could tell me what error or no matter what format was changed

    Thanks and greetings
    Srikkanth

    example:

    SQL> ed
    Wrote file afiedt.buf
    
      1  SELECT dbms_xmlgen.getXml(
      2  'SELECT empno "EMP_NO"
      3  , ename "NAME"
      4  , deptno "DEPT_NO"
      5  FROM emp'
      6* ) FROM dual
    SQL> /
    
    DBMS_XMLGEN.GETXML('SELECTEMPNO"EMP_NO",ENAME"NAME",DEPTNO"DEPT_NO"FROMEMP')
    --------------------------------------------------------------------------------
    
    
     
      7369
      SMITH
      20
     
     
      7499
      ALLEN
      30
     
     
      7521
      WARD
      30
     
     
      7566
      JONES
      20
     
     
      7654
      MARTIN
      30
     
     
      7698
      BLAKE
      30
     
     
      7782
      CLARK
      10
     
     
      7788
      SCOTT
      20
     
     
      7839
      KING
      10
     
     
      7844
      TURNER
      30
     
     
      7876
      ADAMS
      20
     
     
      7900
      JAMES
      30
     
     
      7902
      FORD
      20
     
     
      7934
      MILLER
      10
     
    
    
  • How to generate the sequence Island-1, -1, 1, 1...

    How to generate the sequence Island-1, -1, 1, 1...

    This seems to work:

    create sequence sss start with -1 increment by 2 minvalue -1 maxvalue 1 cycle nocache;
    
  • How to remove the printer driver under windows Vista software

    How to remove the printer driver under windows Vista

    Hello

    Add or remove a printer
    http://Windows.Microsoft.com/en-us/Windows-Vista/add-or-remove-a-printer

    Solve printer problems
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-printer-problems

    --------------

    If you have an error spooler or service use these methods to make them disappear including having to re - install
    the same printer if you intend to remove it.

    Check chan seen message here - one of the highest.

    fixed spooler subsystem app stopped working
    http://social.technet.Microsoft.com/forums/en/itprovistaprinting/thread/460f297a-dd66-4476-A176-542e1519ca3e

    ===================================

    If the above didn't help:

    Use this method to clear the spooler and then uninstall and reinstall your printer (check with the manufacturer for)
    the latest driver).

    Check Mr. Fixits here and if you use the other methods go back and try again later.

    Problems of print and error - a Mr Fixit of printing
    http://support.Microsoft.com/GP/printing_problems

    Solve printer problems - a Mr Fixit
    http://windowshelp.Microsoft.com/Windows/en-us/help/8c11977e-8244-408f-A036-7978a618d7a21033.mspx

    ------------------------------------------------------
    Logon as administrator

    Start - type in the search box-> COMMAND - control to the top of the list and RIGHT CLICK – RUN AS ADMIN

    You can copy and paste each line except those brackets and press ENTER after each.

    net stop Spooler

    (echo suppression of all print jobs)<-- you="" should="" see="" this="">

    ping localhost n 4 > zero

    del/q %SystemRoot%\system32\spool\printers\*.*

    net start Spooler

    (sound Done!)<-- you="" should="" see="" this="">

    ping localhost n 4 > zero

    Another way
    http://4sysops.com/archives/how-to-cancel-a-print-job-that-hangs-under-Windows-Vista-and-XP/

    Check the print - DELETE/STOP queue all jobs - then right click on the printer - REMOVAL
    http://windowshelp.Microsoft.com/Windows/en-us/help/bb6f81d9-4092-4ac8-9716-2bd008f513e11033.mspx

    If you use Control Panel - Classic - printers

    Try after unplugging your printer if necessary.
    -------------------------------------------------------------

    Also check the spooler print and its dependencies and addictions Service.

    Print Spooler service
    http://www.blackviper.com/WinVista/services/Print_Spooler.htm

    How difficulty Windows Vista print spooler starts do not
    http://www.ehow.com/how_4920100_vista-print-spooler-not-starting.html

    ------------------------------------------------------------

    Check this thread if necessary - to stop and erase the spooler

    http://social.answers.Microsoft.com/forums/en-us/vistaperformance/thread/a15779d6-ac0d-42FD-9Ac2-a1da241ea19f/

    and here
    http://social.answers.Microsoft.com/forums/en-us/vistahardware/thread/58b54fa9-cf6f-40F7-90b2-8093c6777493

    ------------------------------------------------------
    Clean the General corruption and repair or replace the damaged/missing files.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN

    Enter this at the command prompt - sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    CheckDisk (chkdsk) runs at startup.

    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • How to generate the ddl for unlimited quota

    Hi all

    DB: Oracle 9.2.0.4
    OS: Solaris 8

    I have a 12 tablespaces and 18 users of the application.
    I would like to grant an unlimited quota for all users on all areas of storage, to find out how to generate the ddl script.

    ex: change the dataagent user quota unlimited on DSOM.

    can anyone help us.
    Thank you
    KK.

    All users in all areas of storage?

    Select "edit user" | user name | "quota unlimited on | nom_tablespace | ';'
    from dba_users cross join dba_tablespaces
    When not in dba_tablespaces.tablespace_name ('SYSTEM', "SYSAUX");

    Please, be careful with this

    HTH
    Antonio NAVARRO

  • How to generate the script to insert data tables present in a

    How to generate the script to insert data from one table in an entire schema under environment sqlplus




    with toads it please help me please!

    905310 wrote:
    How to generate the script to insert data from one table in an entire schema under environment sqlplus
    with toads it please help me please!

    The correct method by using the pump of the database or import/export or unload the data in CSV format for loading using SQL * Loader.

    Generate instructions insert with literals is very bad choices - the bind variable is missing. It will be quite slow because many other CPU cycles are spend on hard analysis. The shared pool will become fragmented. This can cause errors of memory for other applications when they attempt to analyze SQLs for cursors.

  • How to remove the extra space of oracle database column

    How to remove the extra space of oracle database column. I would like to clean up the column in the database by deleting the extra space is entered by the dataentery people.

    When I run the query:
    SELECT
    ROWID, C.CODETABLE_ID, C.CODEVALUE_ID, C.DESCR, LENGTH (C.CODEVALUE_ID).
    C.OBSOLETE_DT, C.RECORDSOURCE, C.CREATED_DT,
    C.CREATEDBY, C.LASTUPDATED_DT, C.LASTUPDATEDBY
    OF CODEVALUE C
    Where LENGTH (C.CODEVALUE_ID) > 6

    the data type is varchar2 and I would get rid of the any extra blank space added to the column. in my case, if the length is greater than 6

    Hello

    user452051 wrote:
    Thanks for the reply. Why should I have this line?

    AND codevlaue_id! = TRIM (codevalue_id) - see note below
    ;

    I just changed my post when you posted this. The explanation is there now:

    Frank Kulash wrote:
    ...
    The condition "codevlaue_id!" = TRIM (codevalue_id)"does not change the results of everything, but it can make the most effective statement if there are lines where codevalue_id is on 6 characters long, but contains no additional space. It will prevent the triggers from firing and redo the data generated.

  • How to format the hard duct under XP?

    How to format the hard drive under XP?

    Hello

    You can format when reinstalling XP or installing another operating system process.

    http://pcsupport.about.com/od/OperatingSystems/SS/instxpclean1.htm

    See you soon.

  • How to generate the report on rules

    How to generate the report on rules with id recipient and with a few keyoword in a rule.

    The rule management dashboard has an integrated 'report rules', you can configure properties and input parameters.

    For rule management dashboard, click homes > Administration > rules. In the upper right, next to the date and time, click reports.

    You can also find these helpful videos: http://edocs.quest.com/foglight/5610/Foglight_Reports_videos.php

    Hope this helps,

    Shay

  • How to remove the menu by default oracle froms 6i

    How to remove the default window menu Oracle forms 6i.

    Amatu Allah Neveen Ebrahim wrote:

    As Salamu Asalam we Rahmatu Allah we Barakatu,.

    How are Hamid, you?

    The OP wondered about: form Menu of the window no.

    Best Regatds,

    Amatu Allah.

    Walikum As Salam O Rahmatillahi we Barakatu, sister Amatu Allah.

    Alhumdolilah. How about you?

    Average don't want to see window menu name?

    Oh, so that's that.

    1. quastion in THE HOW TO REMOVE MENU 'WINDOW' of ORACLE FORMS

    Hamid

  • How to generate the alert when pageitem move on the page? and what class boss be use to move pageitem

    How to generate the alert when pageitem move on the page? and what class boss be use to move pageitem

    Hi Philippe,.

    You can see the kDocBoss for the ClassID with the PMIID IID_ITRANSFORM_DOCUMENT kLocationChangedMessage.

    Markus

  • How to generate the array Diagnostic Utility ADU for Esxi server

    How to run Diagnostic Utility ADU or HP Insight Diagnostics HP Insight Diagnostics table to collect the status tables and logs data FRO an Esxi Server

    How to generate the array Diagnostic Utility ADU for Esxi server

    Example:

    Download the package .vib here: http://vibsdepot.hp.com/hpq/feb2013/esxi-5x-vibs/hpacucli/hpacucli-9.40-12.0.vib

    and place it on a store of data seen by the host...

    Install it using the CLI:

    software esxcli vib install d vmfs/volumes //hpacucli-9.40-12.0.vib

    Now run it:

    ~ # cd/opt/hp/hpacucli/bin

    / opt/HP/hpacucli/bin # . / hpacucli

    HP Array Configuration Utility CLI 9.40.12.0

    Detection of controllers... Fact.

    Type 'help' for a list of supported commands.

    Type "exit" to close the console.

    => ctrl all diag file=/tmp/my_ADUreport.zip ris = on = on zip xml = on

    Generation of diagnostic report... done

    -Online output

    / opt/HP/hpacucli/bin #.

    my_ADUreport.zip in / tmp can now be downloaded from the host...

    It could be that useful...

    / Rubeck

  • HOW to: Change the default "save under" path Reader 8.1.2

    HOW to: Change the default "save under" path Reader 8.1.2

    Thank you!

    Not possible, unfortunately.

  • How to generate the random password policy password knowing resources

    Hello

    Any body tell me how to generate the random password policy password knowing the purpose of resource in OIM11g

    Kind regards
    Mireille Nayan

    Hi Pascal,.

    You can try the below code snippet:

    UserRepository your = new DBUserRepository();
    UserInfo user = your.getUserInfo (take);
                   
    ResourceRepository rrepo = new ResourceDBRepository();
    Resource = rrepo.findResource (resourceName);
              
    By PasswordPolicyAssignmentsRepository = new PasswordPolicyAssignmentsDBRepository();
    PasswordPolicyRepository ppr = new DBPasswordPolicyRepository();
    The list of passwordPolicyAssignments = par.getPasswordPolicyAssigments (resource);
    PasswordPolicy passwordPolicy;
                   
    PasswordPolicyAssignment passwordPolicyAssignment = passwordPolicyAssignments.get (0) (PasswordPolicyAssignment);
    If (isApplicable (passwordPolicyAssignment, {getMappedAttributes (userInfo.getAttributes ())})})
    passwordPolicy = ppr.find (passwordPolicyAssignment.getPasswordPolicyID ());
    }
    RPG RandomPasswordGeneratorImpl = new RandomPasswordGeneratorImpl();
    password = rpg.generatePassword (userInfo, passwordPolicy);

    Kind regards
    GYAN

  • How to generate the password encoded using agent in ODI?

    Hello

    I've created a scenario and I plan to them. Now, I want to create an autonomous agent to run this scenario. To do this, I update odiparams.bat file where I am mentioning the details of the repository. I want to generate the encoded password repository connection using batch processing utility officer. After you type following command at the command prompt in windows xp:
    agent to encode the password
    Failure of the sound connection password invalid username error display.

    What should do? How to generate the password encoded using batch agent utility?

    Thank you
    Shrinivas

    Published by: Shrinivas Dayma on 13 Aug 2011 02:03

    Hi Shrinivas,

    This command is for ODI 10 g.

    For 11g,.

    Encode

    Thank you
    Guru

Maybe you are looking for

  • Why the sites I visit will not stay the way which I configure them when I use Firefox?

    For example: when I go on MSNBC I put the number of articles for different subjects and they go back by default every time I open firefox. This does not happen with IE. Another is that I have to log in to my hotmail and Gmail account every time that

  • How to find people with experience of programming for firefox

    Well, I know it's weird to post this question on the forum, but I ask for key words in the resume to look for not trying to recruit to the Commission. I am a former developer but applications and all I can say is that by doing a search through the re

  • Clear/fill ComboBox in a Subvi?

    I am building an app with 6-8 pulldown ComboBoxes and each of them will be erased and then first met based on a file.  I wrote a small vi to do exactly what I want, but I can't understand how to pass the PropertyNode[tringsAndValues] each ComboBox to

  • How can I move the Tablet PC Input Panel to a secondary monitor?

    I've been manually stop and start the Tablet PC Input Service to avoid conflicts with the apps full screen.  I wouldn't do it if I could find a way to move the Tablet PC Input Panel to a secondary monitor.  There seems to be no option for this.  Some

  • Can't go back to the classic view EA2700

    Whenever I run the update of the firmware manually, the rear roll fails when it's about 90% of the way through.  I have reset the router to the conditions of the factory several times, he keeps failing. Something prevents the installation of the comp