Returns the ASCII value of the first character of the given character expression.

Syntax

ASCII ( char_expression )

Example

The following example shows how to use the ASCII function:

SELECT ASCII ( PostalCode ) 
     FROM Customer;

Notes

  • The argument to the function must be of type CHARACTER.
  • The result is of type INTEGER.
  • If the argument char_expression evaluates to NULL, the result is NULL.
  • The ASCII function is character‑set dependent and supports multi‑byte characters. The function returns the character encoding integer value of the first character of char_expression in the current character set. If char_expression is a literal string, the result is determined by the character set of the SQL client. If char_expression is a column in the database, the character set of the database determines the result.

Compatibility

ODBC compatible