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

Home -> Community -> Usenet -> c.d.o.tools -> Re: How can I modify (decrease) a column ?

Re: How can I modify (decrease) a column ?

From: Bob Fazio <rfazio_at_home.com.nospam>
Date: 2000/05/26
Message-ID: <bSuX4.209856$Tn4.1867180@news1.rdc2.pa.home.com>#1/1

The reason that it won't let you is because it is just doing the easy thing and saying I won't make it smaller unless it's empty.

create a table with the following if you aren't using 8i.

create table temp_table as select pk,column_I_want_to_change from my table;

update the table you want to change and set all rows to null (column_I_want_to_change ).

change the field.

Use the temp table to update the values back.

drop the temp table.

--
Robert Fazio, Oracle DBA
rfazio_at_home.com
remove nospam from reply address
http://24.8.218.197/
"Peter Wichert" <peter.wichert_at_gis.dew.de> wrote in message
news:8gl625$9qi$1_at_gdv106.gis.dew.de...

> Hi,
>
> I'm trying to change the layout of a table. I just want to change a
CHAR(10)
> to CHAR(8), and ORACLE tells me to clear (empty) the table first. But I
> don't have records with longer entries than 8 chars, so why must I delete
my
> records?
>
> It says:
>
> "column to be modified must be empty to decrease column length"
>
> Generally spoken, is there a solution to savely change my database layout
> (shure, "compatible" changes only) without loosing my data (if I know what
> i'm doing :-)) ?
>
> Thanks for any help,
> Peter
>
Received on Fri May 26 2000 - 00:00:00 CDT

Original text of this message

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