SQL ASCII Function
If you want to find a numerical value of a character which is in range of 0 to 255 you can use SQL ASCII function. If you pass a NULL string to ASCII function it will return NULL. If the string is empty, the function will return 0. Any character which its range is out of 0 to 255, the ASCII function will return an error or ignored based on implementation of RDBMS. Here is the syntax of ASCII function:
ASCII(expression)
Here is an example of finding ASCII value of character a in both lower case and upper case:
SELECT ASCII('a') AS lower_case_a,
ASCII('A') AS upper_case_a
And here the output of ASCII value of lower and upper case of character 'a'
lower_case_a upper_case_a
------------ ------------
97 65