ASCII_VAL()

<< ASCII_CHAR() | FB 2.1 Language Reference | ASIN() >>

ASCII_VAL()

Available in: DSQL, PSQL

Added in: 2.1

Description

Returns the ASCII code of the character passed in.

Result type: SMALLINT

Syntax

 ASCII_VAL (<ch>)

 ch  ::=  a [VAR]CHAR or text BLOB of max. 32767 bytes


  • If the argument is a string with more than one character, the ASCII code of the first character is returned.
  • If the argument is an empty string, 0 is returned.
  • If the argument is NULL, NULL is returned.
  • If the first character of the argument string is multi-byte, an error is raised. (A bug in Firebird 2.1–2.1.3 causes an error to be raised if any character in the string is multi-byte. This is fixed in 2.1.4.).

Important: If the external function ascii_val is declared in your database, it will override the internal function. To make the internal function available, DROP or ALTER the external function (UDF).

back to top of page
<< ASCII_CHAR() | FB 2.1 Language Reference | ASIN() >>