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: Jan Schaefer <schaefer_at_kksl.uni-leipzig.de>
Date: Mon, 15 Oct 2001 10:53:02 +0200
Message-ID: <9qe84j$c6t$1@news.uni-leipzig.de>


> I have some columns that have a lot of padding after the last letter
of
> the entries. I tried to alter
> them using the "alter table" command, but it tells me they have to be
empty
> in order for this to work.
> I tried to copy the column to a view, shorten the original column length,
> but when I try to put them back, of
> course I'd get the error that the data is "too long" for the column
because
> of the padding....any suggestions
> other than manually re-entering the data?

Create a new and shorter column.

Copy all values from the old to the new column with

update table xyz
set new_column = lpad(old_column, options)

drop old column

Hope that works.

So long,

Jan Received on Mon Oct 15 2001 - 03:53:02 CDT

Original text of this message

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