RE: [Q] shrink varchar2 size and truncate data????

From: Bort, Guillermo <>
Date: Tue, 21 Oct 2008 12:50:44 -0500
Message-ID: <>

How about sth like:  

update functions set instructions=substr(instructions,0,1000) where lentgh(instructions) > 1000;  

(where clause is not necessary, though it could improve performance by using an index should instructions have one)  

Then alter the table.  


Guillermo Alan Bort

DBA / DBA Main Team  

EDS, an HP company

ITO Arias 1851

Ciudad Autonoma de Buenos Aires (C1429DXC)


Tel: +54 11 4704-3132

E-mail: <>  

We deliver on our commitments

so you can deliver on yours.  

[] On Behalf Of dba1 mcc Sent: Tuesday, October 21, 2008 3:17 PM
Subject: [Q] shrink varchar2 size and truncate data????  

we have a table has a field define as "varchar2(2000)", we tried to change size from varchar2(2000) TO VARCHAR2(1000). dUE TO SOME RECORDS DATA LARGE THAN 1000.   I can use following sql statemnet to find which records > 1000 characters, but how can I truncate data larger than 1000 characters?  

select id, length(INSTRUCTIONS) from functions where length(INSTRUCTIONS) >=1000;  

Received on Tue Oct 21 2008 - 12:50:44 CDT

Original text of this message