PostgreSQL ASCII
From w3cyberlearnings
Contents |
Postgresql asci
This function return the ASCII code of the first character of the argument.
Syntax asci
asci(stringr)
Example 1
test2=# SELECT ascii('a'); ascii ------- 97 (1 row) test2=# SELECT ascii('$'); ascii ------- 36 (1 row) fro
Example 2
Get ASCII for the first letter of the first name.
test2=# SELECT user_firstname, test2-# ascii(substring(user_firstname from 1 for 1)) test2-# FROM profile; user_firstname | ascii ----------------+------- Jim | 74 king | 107 Jammi | 74 Bob | 66 | (5 rows)