Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Beginner - Update table
"Mark Muller" <mmu_at_beer.com> wrote in message
news:aspm6a$mvj$1_at_news.hccnet.nl...
> How to write a sql script that whill alter an existing table to a new
> definition
>
> I have to modify tables, i know what the columns should be, but not what
> they were (depending on last change at customer site),
> for example the following table where MOB is a new column. When i try this
> oracle (9i) is complaining the column ID already is NOT NULL and does not
> add the MOB column.
>
> ALTER TABLE vaccin.HUISARTS MODIFY (
> ID CHAR(10) not null,
> NAME CHAR(30) not null,
> TEL CHAR(15) null,
> FAX CHAR(15) null,
> MOB CHAR(15) NULL
> );
>
>
You must supply a default value to the not-null column (ID) definition, otherwise Oracle doesn't know how to initialise the column for the already existing records.
... ID CHAR(10) not null default "????????"...
May be later on it will complain for the NAME column.
Bye,
Flavio
Received on Fri Dec 06 2002 - 07:05:55 CST