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

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

Re: Insert without telling column names

From: David A. Barbour <dbarbour_at_nucentrix.net>
Date: Tue, 20 Mar 2001 19:06:41 -0800
Message-ID: <F001.002D29DD.20010320184105@fatcity.com>

Hi all -

I stand (sit?) before you with egg on my face. I KNOW you can insert without naming column names if you're filling the entire row, I just didn't consider that this might be what Roland was attempting to accomplish. As Regina and Jacques both pointed out, if your package, procedure or script is to be reused, it's probably best not to assume the table structure you think will be there actually is there.

With humble apologies,

David A. Barbour
Oracle DBA
Formerly with the now defunct and bankrupt ConnectSouth

William Beilstein wrote:
>
> You are misinformed. If you have a table of the form
>
> col1 varchar2(1)
> col2 number
> col3 date
>
> You can insert into it with the insert statement
> INSERT INTO MYTABLE VALUES('X',23,SYSDATE);
>
> As long as ALL the columns are included in the values clause in the order they were
>created in the table, you don't have to define the column names.
>
> >>> dbarbour_at_nucentrix.net 03/20/01 11:36AM >>>
> Roland,
>
> 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)?
>
> 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?
>
> Regards,
>
> David A. Barbour
> Oracle DBA
> Formerly with the now defunct and bankrupt ConnectSouth
>
> Roland.Skoldblom_at_ica.se 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: http://www.orafaq.com
> > --
> > Author:
> > INET: Roland.Skoldblom_at_ica.se
> >
> > 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: ListGuru_at_fatcity.com (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).
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: David A. Barbour
> INET: dbarbour_at_nucentrix.net
>
> 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: ListGuru_at_fatcity.com (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).
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: William Beilstein
> INET: BeilstWH_at_obg.com
>
> 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: ListGuru_at_fatcity.com (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).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: David A. Barbour
  INET: dbarbour_at_nucentrix.net

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: ListGuru_at_fatcity.com (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 - 21:06:41 CST

Original text of this message

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