Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to shorten a column's length that already HAS data in it?

Re: How to shorten a column's length that already HAS data in it?

From: Robert Boyle <rboyle_at_cyantel.com>
Date: 15 Oct 2001 02:09:35 -0700
Message-ID: <8729a6fe.0110150109.5d4ea5b5@posting.google.com>


Sounds to me like you are using a CHAR field type. I would do two things (based on the fact that your original field is CHAR(50):

ALTER TABLE mytable
MODIFY myfield VARCHAR2(50)
/

UPDATE TABLE mytable
SET myfield = TRIM(myfield)
/

COMMIT
/

ORACLE will pad your field with spaces if you have a CHAR field as the field is a fixed length. A VARCHAR2 field is of variable length and so is not padded. Should really use these whenever possible.

HTH
R. Received on Mon Oct 15 2001 - 04:09:35 CDT

Original text of this message

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