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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How can I insert multiple values in the same SQL command?

Re: How can I insert multiple values in the same SQL command?

From: <mark_fredericks_at_my-dejanews.com>
Date: Thu, 15 Apr 1999 14:10:30 GMT
Message-ID: <7f4s0g$gsh$1@nnrp1.dejanews.com>


The only way, currently in Oracle, to insert multiple (host variable) records with a single insert is to use array processing with embeded SQL in PRO*C or one of the other 3GL programatic interfaces.

If you are in pl/sql you have two approaches:

  1. use an insert multiple times, once for each inserted record - not elegant.
  2. create a plsql procedure that contains the insert. Call the procedure within a loop or with different variables as required. The procedure, if stored in library or implemented on the database, could potentialy be reused in the application.

HTH Mark

In article <7f4bhd$upf$1_at_news6.svr.pol.co.uk>,   "Neil Robinson" <vtr_at_firestorm996.freeserve.co.uk> wrote:
> I need to insert as many as 10 records in one sql command. I've tried
> guessing at the correct syntax, but cannot do it. I'll be inserting data
> from variables rather than from another table, so I can't use the "INSERT
> ([fields]) VALUES (SELECT * FROM....) syntax either.
>
> Any help would be greatly appreciated.
>
> --
> Neil Robinson
>
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Apr 15 1999 - 09:10:30 CDT

Original text of this message

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