Oracle / PLSQL: TO_SINGLE_BYTE Function

This article is written about how to use the Oracle/PLSQL TO_SINGLE_BYTE function with syntax and examples.

Description

The Oracle/PLSQL TO_SINGLE_BYTE feature returns a personality cost with all of the multibyte characters converted to single-byte characters. To use this function, your database persona set contains both single-byte and multibyte characters.

Syntax

The syntax for the TO_SINGLE_BYTE characteristic in Oracle/PLSQL is:

TO_SINGLE_BYTE( char )

Parameters or Arguments

char A char, varchar2, nchar, or nvarchar2 fee that will be transformed to single-byte characters. This feature will return its end result in the identical character set as char.

Returns

The TO_SINGLE_BYTE characteristic returns a single byte value.

Applies To

The TO_SINGLE_BYTE characteristic can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let’s seem to be at some Oracle TO_SINGLE_BYTE function examples and explore how to use the TO_SINGLE_BYTE characteristic in Oracle/PLSQL.

For example:

select TO_SINGLE_BYTE('Tech on the net')
from dual;

The SQL assertion above would return a single-byte personality value.