I wonder if this is possible in oracle to replace row number (we can use ROW_NUMBER()
for example to get a digit) into alfabetical numbering
Let's say to get something like
NO | Name | Surname
================
A | John | Doe
B | Will | Doe
C | Jim | Wonder
instead of
NO | Name | Surname |
=================
1 | John | Doe
2 | Will | Doe
3 | Jim | Wonder
I have an idea to create a variable like "ABCDEFG" and convert row number into correct SUBSTR
, but this sounds a little unstable
Temporary solution for A-Z is to use
CHR((ROW_NUMBER() OVER (PARTITION BY SOMECOLUMN ORDER BY 1))+64)
I created function that converts number to characters:
You can use it in selects:
1 - A, 2 - B, ... , 25 - Y, 26 - Z, 27 - AA, 28 - AB, ..., 703 - AAA, 704 - AAB, ...