sql - How generate oracle string sequence? -



sql - How generate oracle string sequence? -

i need generate unique identifiers must no longer 5 length, because of numbers don't fit, there way generate unique strings in oracle database?

this method utilize numbers in hex format.

select to_char(seq.nextval, 'fm0xxxx') dual;

or more compact method utilize symbols between ascii code 33 , 122:

select num, chr(33 + mod(floor(num/(90*90*90*90)), 90))|| chr(33 + mod(floor(num/(90*90*90)), 90))|| chr(33 + mod(floor(num/(90*90)),90))|| chr(33 + mod(floor(num/90),90))|| chr(33 + mod(num,90)) x00000 (select seq.nextval num dual);

basically representation of 90-based number.

sql oracle sequence

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -