Purpose
TO_CLOB() converts NCLOB values in a LOB column or other strings to CLOB values.
Syntax
TO_CLOB(lob_column | char)
Parameters
| Parameter | Description |
|---|---|
| lob_column | NCLOB values in a LOB column or other strings. |
| char | Values of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB type. |
Return type
The return type is CLOB.
Examples
Assume that you have created the table tbl_nclob. Convert VARCHAR2 values to CLOB values and insert them to the column of the CLOB type.
obclient> DESC tbl_nclob;
+----------+---------------+------+-----+---------+-------+
| FIELD | TYPE | NULL | KEY | DEFAULT | EXTRA |
+----------+---------------+------+-----+---------+-------+
| COL1 | NUMBER(38) | YES | NULL | NULL | NULL |
| COL_CHAR | VARCHAR2(100) | YES | NULL | NULL | NULL |
| COL_CLOB | CLOB | YES | NULL | NULL | NULL |
+----------+---------------+------+------+--------+-------+
3 rows in set
obclient> UPDATE tbl_nclob SET col_clob = TO_CLOB (col_char);
Query OK, 1 row affected
Rows matched: 1 Changed: 1 Warnings: 0