How to change column type from LONG to VARCHAR2(4000)
Hi All
I need to change type for one column "AdditionalInfo" from LONG to VARCHAR2(4000) in my table ProjectVersionTab.
I note that texts in this columns don't exceed length of 4000 characters and will not be truncated.
When I tried to execute following command
alter table ProjectVersionTab modify (AdditionalInfo varchar2(4000));
I've got such error:
01439. 00000 - "column to be modified must be empty to change datatype"
The I tried something with additional column:
alter table ProjectVersionTab add (AdditionalInfo2 varchar2(4000));
update ProjectVersionTab set AdditionalInfo2 = sys.dbms_metadata_util.long2varchar(4000,'cmgsfa.ProjectVersionTab','additionalinfo',rowid);
alter table ProjectVersionTab drop column AdditionalInfo;
alter table ProjectVersionTab rename column AdditionalInfo2 to AdditionalInfo;
My questions are:
1.Does any way exist how to do it without additional columns?
2.Can some coversion problems occurs when I copy texts from LONG to VARCHAR2 by way mentioned above?
thanks