Purpose
This function converts NCLOB values in a LOB column or other string to CLOB values.
Syntax
TO_CLOB(lob_column | char)
Parameters
Parameter |
Description |
|---|---|
| lob_column | The NCLOB value in a LOB column or other string. |
| char | The value of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB type. |
Return type
CLOB
Examples
Assume that a table named tbl_nclob has been created. This example converts a VARCHAR2 value to a CLOB value and inserts it into a CLOB column.
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
