Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Insert without telling column names

Re: Insert without telling column names

From: Regina Harter <>
Date: Tue, 20 Mar 2001 10:45:30 -0800
Message-ID: <>

At 08:36 AM 3/20/01 -0800, you wrote:
>You can't. There are a number of ways to really cut down on the code
>required to do an insert, but if you think about it, how will Oracle
>know where the data is supposed to go if you don't give it the column
>name(at some point)?

Of course you can. The only caveat is Oracle will assume you are filling all the columns in order, therefore you must provide a value for every column, ie
For Table T1(firstname, lastname, telephone, fax, email)

insert into T1 values('John','Smith','4849910','','')

Note the '' in place of a fax number. I could also have used null.

I never use this method in applications or procedures, of course, because then if you change the table definition it no longer works, but for testing stuff, or something I'm only going to run once it's a decent shortcut.

>If you're using 8i, there is a direct load insert, but as far as I'm
>aware, this will work only for a select * from another table.
>Dynamic SQL works pretty well for this kind of stuff. What are you
>trying to do?
>David A. Barbour
>Oracle DBA
>Formerly with the now defunct and bankrupt ConnectSouth
> wrote:
> >
> > Hallo,
> >
> > How can I create an insert statement without telling all the names of
> the columns?
> > Give an example, please.
> >
> > Roland Sköldblom
> >
> > --

Please see the official ORACLE-L FAQ:
Author: Regina Harter

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
To REMOVE yourself from this mailing list, send an E-Mail message
to: (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Mar 20 2001 - 12:45:30 CST

Original text of this message