Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Converting Varchar2 datatype into Clob datatype

Re: Converting Varchar2 datatype into Clob datatype

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 11 Apr 2002 17:36:27 -0700
Message-ID: <a95a6b05s7@drn.newsguy.com>


In article <3cb5c02b$0$15767$4c41069e_at_reader0.ash.ops.us.uu.net>, "Rajesh says...
>
>Hi
>
>How we can convert VARCHAR2 datatype into CLOB datatype.
>
>Thanks in Advance.
>
>Rajesh
>
>
>

well, you cannot directly "convert" but you can:

alter table emp add ename_clob clob;
update emp set ename = null, ename_clob = ename; alter table emp set unused (ename);
rename emp to emp_table;
create or replace view emp as select empno, ename_clob ename, job, mgr, hiredate, sal, comm, deptno
from emp_table;

that would "change" ename from a varchar2 to a clob...

You can do a CREATE TABLE new_table followed by insert /*+ append */ into new_table select * from old_table followed by drop old_table, rename new_table to old_table -- add indexes, etc as well.

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Thu Apr 11 2002 - 19:36:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US