Skip to content

TO_ASCII

Return the ASCII value for a character string stored in a LATIN9 database.

TO_ASCII(string [, 'latin9'])

For example:

premdb=# SELECT TO_ASCII('µ') from sys.const;
 to_ascii 
----------
 u
(1 row)

premdb=# premdb=# SELECT TO_ASCII('µ', 'latin9') from sys.const;
 to_ascii 
----------
 u
(1 row)

This function runs only on LATIN9 databases and accepts only the LATIN9 encoding as the second argument. Encoding conversion from UTF8 to ASCII is not supported.

For example, the following query returns an error:

premdb=# SELECT TO_ASCII('µ','UTF8') from sys.const;
ERROR:  encoding conversion from UTF8 to ASCII not supported

Parent topic:String Functions