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
Post a Comment