Random Alphanumeric

To generate the needed random alpha digits part call the random number generator and multiply the result by 100. Use the PL/SQL CEIL, ROUND or TRUNC function to convert it to integer. Use the k=MOD(n,25) to get a random number between 0 and 25. To find the appropriate random letter construct the expression L=CHR(ASCII(‘A’)+k)

If you would like to use upper or lower case you can also add something like the following:
SELECT sysdate INTO d FROM dual;
sec1 := TO_CHAR(d,’SS’);
sec := TO_NUMBER(sec1);
IF MOD(sec,2)=0 THEN LOWER(the_letter)

or You may do like this

RandNum := DBMS_RANDOM.VALUE(0, 100);

Always closed the session after generate random number use

DBMS_RANDOM.TERMINATE;

One thought on “Random Alphanumeric

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s