ASCII

The ASCII function returns the ASCII code value of the leftmost character of the argument as an integer.

Read syntax diagramSkip visual syntax diagramASCII(expression)
expression
An expression that specifies the string containing the character to evaluate. expression must be any built-in numeric or string data type. The first character of the string will be converted to ASCII CCSID 367 for processing by the function.

The result of the function is a large integer. If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Examples

  • Return the integer value for the ASCII representation of 'A'.
    SELECT ASCII('A')
        FROM SYSIBM.SYSDUMMY1
    Returns the value 65.