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

Home -> Community -> Usenet -> c.d.o.server -> Re: Resize Columns Correction

Re: Resize Columns Correction

From: <davidho99_at_my-deja.com>
Date: Thu, 16 Sep 1999 23:58:01 GMT
Message-ID: <7rs064$6vf$1@nnrp1.deja.com>


In article <7rrva2$687$1_at_nnrp1.deja.com>,   davidho99_at_my-deja.com wrote:
> To increase column size (easier!):
> =================================
>
> o ALTER TABLE mytable MODIFY(mycolumn varchar2(100));
>
> To reduce column size :
> ===============================
>
> o user same ALTER TABLE statement as above, if you have NO DATA in the
> column
>
> o However if you have data, then follow the steps below:
>
> Assume DEPT has a column DEPT_ID of varchar2(10), and you want to
change
> to char(2):
>
> Steps
> =====
> 1. Create another table, say DEPT2 with DEPT_ID of char(2)
>
> sqlplus > create table DEPT2 (char(2));

SHOULD BE         sqlplus > create table DEPT2 (DEPT_ID char(2));

ALSO, assume that the DEPT_ID of old table does not have data which is more than 2 characters.

>
> 2. Copy the data from DEPT to DEPT2
>
> sqlplus > insert into DEPT2
> select DEPT_ID from DEPT;
>
> 3. Rename both tables
>
> sqlplus > rename DEPT to DEPT_OLD;
> sqlplus > rename DEPT2 to DEPT;
>
> David Ho
>
> In article <37DE9B2E.98E4F944_at_fmr.com>,
> Karen Abgarian <karen.abgarian_at_fmr.com> wrote:
> > alter table xx modify(n varchar2(100));
> >
> > You can even make it shorter if you have all NULLs in the column.
> >
> > Regards,
> > Karen Abgarian.
> >
> > In2Home User wrote:
> >
> > > I'm sure this is an age-old question, but
> > > can I resize the columns of an Oracle 8.0.5 table
> > > without having to drop and recreate the table?
> > >
> > > Thanks,
> > >
> > > Chris
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Sep 16 1999 - 18:58:01 CDT

Original text of this message

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