How to make varchar2 field shorter in Oracle?

I have a field in the varchar2 table, 4000 bytes. There are over 50,000 lines. Not all rows have data in this field. Several data fields exceed 255 bytes, but some of them are 4000. To put a table in a new application, I need to reduce the field to 255 bytes.

Is there an SQL statement that will reduce the length to 255? I understand that data will be lost, which is part of the cost of a new application. The section should be arbitrary, just stopping the data at 255, regardless of the circumstances.

+10
oracle
Dec 6 2018-11-17T00:
source share
1 answer
update b set text2 = substr(text2,1,255); 

then alter table to set the column length to 255 :

 alter table b MODIFY "TEXT2" varchar2(255 byte); 
+30
Dec 06 '11 at 17:38
source share



All Articles