Demonstrate a method of converting to a LONG column to CLOB: : Long « Data Type « Oracle PL / SQL






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.

   
    
  








Related examples in the same category

1.Set long: query a table or view that has a LONG column
2.Change column type from long to clob
3.Conversion of Longs to LOBs
4.Insert char value to long type column
5.Long raw type column
6.Long type column