Is there anybody who can help me converting base32 values to decimal numbers? I have a sql statement which returns me a list of base32 values. For example the return of the select looks like this:
5
8
H
13r
Now I need to figure out which of these values is the highest (in this case 13r). Therefore I would need a function to convert these base32 values to decimal numbers in order to sort them. Does anybody have such a function or does anybody have a different approach?
It will be little bit tricky.
You can create a
functionwhich will separate each character/digit from the original base32 number and multiply it with 32^(position in base32 number) to get decimal equivalent number and use thatfunctionin your query.Now, use this function in your query as following:
db<>fiddle demo
Cheers!!