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

Home -> Community -> Usenet -> comp.databases.theory -> Re: And again: 1NF may not be dead

Re: And again: 1NF may not be dead

From: --CELKO-- <jcelko212_at_earthlink.net>
Date: 4 Nov 2004 19:15:29 -0800
Message-ID: <18c7b3c2.0411041915.7dad2782@posting.google.com>


>> What I'd like is some kind of SQL command that splits arrays and
lists into multiple inserts, .. Perhaps Mr. Celko can jump in and tell us if things like this are unde r consideration at all. <<

We have it with the table constructor in SQL-92. You just need to pass each array elment to a VALUES() clause:

INSERT INTO Foobar VALUES ((:a[1]), (:a[2]),..(:a[100]));

You can get a little fancier with an array records in the host language, and you can be safe with a little extra code:

INSERT INTO Foobar
SELECT DISTINCT x
  FROM VALUES ((:a[1]), (:a[2]),..(:a[100])) AS InputList(x)  WHERE x IS NOT NULL -- possible rule
   AND {{ other safety predicates on InputList};

--CELKO-- Received on Thu Nov 04 2004 - 21:15:29 CST

Original text of this message

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