Mega Code Archive

 
Categories / Oracle PLSQL / Data Type
 

Demonstrate a method of converting to a LONG column to CLOB

SQL> SQL> SQL> create table t   2  (c1 number primary key,   3  c2 long ); Table created. SQL> SQL> insert into t values (1, 'b'); 1 row created. SQL> SQL> -- This will fail because LONG doesn't support character functions: SQL> select  * from t where instr(c2, 'b') > 0; select  * from t where instr(c2, 'b') > 0                              * ERROR at line 1: ORA-00932: inconsistent datatypes: expected NUMBER got LONG SQL> SQL> -- Change the LONG to CLOB: SQL> alter table t modify c2 clob; Table altered. SQL> SQL> select  * from t where instr(c2, 'b') > 0;          1 b 1 row selected. SQL> SQL> drop table t; Table dropped.