TO_SINGLE_BYTE

TO_SINGLE_BYTE is an Oracle SQL function that converts multibyte characters in a string into their corresponding single-byte equivalents. This conversion depends upon the character set of the database.

Example

SELECT TO_SINGLE_BYTE('SQL文本') FROM dual;

Output

S Q L文本

Explanation

The TO_SINGLE_BYTE function in Oracle converts multibyte characters to their single-byte equivalents if they exist. In this example, only the ascii characters ‘S’, ‘Q’, and ‘L’ have a single-byte equivalents while the multibyte character ‘文本’ does not. Therefore, they remain unchanged in the output.

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