Oracle 10.2.0.4 中转换long类型到CLOB类型时出现ORA-00997: illegal use of LONG datatype错误。
最后用TO_LOB()函数解决:
INSERT INTO T_CLOB SELECT A, TO_LOB(B) FROM T_LONG;
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Connected as reporttest
SQL> CREATE TABLE T_LONG (A NUMBER, B LONG);
Table created
SQL> CREATE TABLE T_CLOB (A NUMBER, B CLOB);
Table created
SQL> INSERT INTO T_LONG VALUES (1, 'LONG DATA TO CLOB');
1 row inserted
SQL> commit;
Commit complete
SQL> INSERT INTO T_CLOB SELECT A, B FROM T_LONG;
INSERT INTO T_CLOB SELECT A, B FROM T_LONG
ORA-00997: illegal use of LONG datatype
SQL> INSERT INTO T_CLOB SELECT A, TO_LOB(B) FROM T_LONG;
1 row inserted
SQL> COMMIT;
Commit complete
SQL> SELECT * FROM T_CLOB;
A B
---------- -------------------------------
1 LONG DATA TO CLOB
转载于:https://blog.51cto.com/xiahouyao123/1258225