Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Converting Varchar2 datatype into Clob datatype
In article <3CB74573.41BB_at_yahoo.com>, Connor says...
>
>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.
>
>(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)'
>
ora932, inconsistent datatypes, only works on longs.
>C.
>--
>==============================
>Connor McDonald
>
>http://www.oracledba.co.uk
>
>"Some days you're the pigeon, some days you're the statue..."
-- Thomas Kyte (tkyte@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 CorpReceived on Fri Apr 12 2002 - 19:56:02 CDT