TO_CHAR (character)

2023-07-28 02:55:42  Updated

Purpose

TO_CHAR (character) converts a value of the NCHAR, NVARCHAR2, or CLOB data type to a value of the VARCHAR2 data type.

Note

When you use this function to convert a LOB value to a value of the database character set, the database returns an error if the LOB value to be converted is larger than the target type.

Syntax

TO_CHAR(character)

Parameters

character is the expression to be converted to the VARCHAR2 data type. It can be of the NCHAR, NVARCHAR2, or CLOB data type.

Return type

The return type is VARCHAR2.

Examples

The following example converts the string 010101 to a character string.

obclient> SELECT TO_CHAR('010101') FROM DUAL;
+-------------------+
| TO_CHAR('010101') |
+-------------------+
| 010101            |
+-------------------+
1 row in set

Contact Us