ASCIISTR

ASCIISTR is a SQL function that converts a string in any character set into an ASCII string using Unicode encoding. It represents non-ASCII characters in the output string as Unicode escape sequences.

ASCIISTR(string)

  • string: This parameter represents the string to be converted. It takes an NVARCHAR2 character as input and converts it to an ASCII string in the database character set. The input can represent any string whether it’s a single character, a word, a sentence, or an entire paragraph. Special characters are represented in output with their Unicode code-point value in the form of ’ nnnn’ or ’\+nnnnnnn’.

Example

SELECT ASCIISTR('Employee: Olé') FROM dual;

Output

'Employee: \00F3l\00E9'

Explanation

The ASCIISTR function returns an ASCII version of the input string, allowing it to display special characters in Unicode escape format. In this example, the special characters in “Olé” are replaced with their Unicode representations \00F3 and \00E9.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.