| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: And again: 1NF may not be dead
>> 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
![]() |
![]() |