Re: create table with null value

From: Henk Hultink <hhu_at_stopspam.stoas.nl>
Date: Fri, 21 Feb 2003 13:36:49 +0100
Message-ID: <3e561d63$1_at_news.wau.nl>


Hi,

Seems to me that you get yourself in a lot of trouble; you have no control over the datatype of the "null-column" you create.

Try this: first create a new table with as many columns as you need (for the datatype)

create table dummy_tab
( col1 varchar2(1)
, col2, varchar2(2)
...
etc.... add all datatypes you wish.

Now suppose you want col3 in table toto2 to be a varchar2(1) column, you do:

create table toto2 as
select

    col1,
    col2,
   ( select col1
     from dummy_tab ) col3
from toto;

This gives you the possibility not only to create an empty column col3 (assuming that table dummy_tab is empty :-), but also to control the datatype of col3.

regards,

Henk

--
H. Hultink
Software Engineer
Stoas, Division OBOI
Wageningen, The Netherlands
"Activating Knowledge"
http://www.stoas.nl

e-mail: hhu_at_stopspam.stoas.nl


"Séb" <spribetich_at_auchan.com> wrote in message
news:b32vcd$29d$1_at_reader1.imaginet.fr...

> It is quicker to create a script that make the creation and the insert at
> the same time.
>
> "Gabriel Gonzalez" <no-spam_at_no-spam.com> wrote in message
> news:3e54e511$1_2_at_binarykiller.newsgroups.com...
> > One question: Why are you doing that?
> >
> >
> >
> >
> > -----------== Posted via Newsfeed.Com - Uncensored Usenet News
> ==----------
> > http://www.newsfeed.com The #1 Newsgroup Service in the World!
> > -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers
> =-----
> >
Received on Fri Feb 21 2003 - 13:36:49 CET

Original text of this message