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: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 12 Apr 2002 21:37:07 +0100
Message-ID: <3CB74573.41BB@yahoo.com>


Thomas Kyte wrote:
>
> 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

(Not having access to my 9i db at the moment ... )

 ... but does TO_LOB only take longs - or can the argument be a varchar2. Ditto the question on 'alter table ( x clob)'

C.

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Fri Apr 12 2002 - 15:37:07 CDT

Original text of this message

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