The TO_CHAR (character) function converts the data of NCHAR, NVARCHAR2, or CLOB to a database character set.
Syntax
TO_CHAR(character )
Parameter
| Description | |
|---|---|
| character | The data type can be NCHAR, NVARCHAR2, or CLOB. |
Return type
The return type is VARCHAR2. When the function converts a character CLOB to a database character set, the database returns an error if the CLOB value to be converted is greater than the desired type.
Examples
Create the CLOBTEST table and insert data to the column of the RAW data type.
CREATE TABLE CLOBTEST(TEXT CLOB);
INSERT INTO CLOBTEST VALUES('DWUIDBWUIDBWIOBFWUIOBFIOWBFWUIOBFUWIFB') ;
Execute the following statements:
SELECT TO_CHAR(TEXT) FROM CLOBTEST;
The following query result is returned:
+----------------------------------------+
| TO_CHAR(TEXT) |
+----------------------------------------+
| dwuidbwuidbwiobfwuiobfiowbfwuiobfuwifb |
+----------------------------------------+