Oracle 将 NCLOB 数据插入 NVARCHAR2

Oracle insert NCLOB data into NVARCHAR2

我正在尝试将 CLOB 数据插入 NVARCHAR2.it 在存储过程中显示错误 ORA - 06512。

如何解决这个错误?

您没有分享太多信息,因此很难猜出您做了什么以及 Oracle 对此提出投诉的原因。不过, TO_NCHAR 会有什么好处吗?

TO_NCHAR (character) converts a character string, CHAR, VARCHAR2, CLOB, or NCLOB value to the national character set. The value returned is always NVARCHAR2

SQL> create table test (col_nclob nclob);

Table created.

SQL> create table test2 (col_nvarchar2 nvarchar2(20));

Table created.

SQL> insert into test values ('x');

1 row created.

SQL> insert into test2 (col_nvarchar2)
  2    select to_nchar(t.col_nclob) from test t;

1 row created.

SQL>