From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Walt Bigelow <walt@stimpy.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] copy one to many?
Date: Sun, 30 Aug 1998 11:58:13 +0300
Message-ID: <l03110704b20ec19e0700@[147.233.159.109]> (raw)
In-Reply-To: <Pine.LNX.4.02.9808271959380.18143-100000@alice.stimpy.com>
References: <001601bdd1f4$c3f9df00$a3f0f6ce@bryan.arcamax.com>
At 6:06 +0300 on 28/8/98, Walt Bigelow wrote:
> I was looking more on the lines of a list of dest values. This list is by
> no means in order, or sequential.
>
> For example: I want to copy this data TO this list of lib #'s
>
> 3422, 4456, 7743... etc (baiscally random)
>
> I'd prefer to have 1 insert statment do the job. Right now I have M$
> Access doing this in a for/next loop, changing the dest lib number for
> each in the list.
>
> I'd prefer to do this on the server end. Whould this be easy to do with
> server side funcs?
Well.... SQL was NOT designed as a procedural language, and when you have
data of a 'random' nature, as you said, you need a procedural languague,
which the current backend doesn't have.
If you want to insert just the new lib numbers into an auxiliary table, you
can easily do the insert as a cartesian product between the rows you want
to duplicates and the rows in the auxiliary table.
Of course, then you'll need a loop for inserting the lib values into the
auxiliary table - or you can do that with a COPY.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: herouth@oumail.openu.ac.il, walt@stimpy.com
Subject: Re: [SQL] copy one to many?
In-Reply-To: <l03110704b20ec19e0700@[147.233.159.109]>
References: <001601bdd1f4$c3f9df00$a3f0f6ce@bryan.arcamax.com> <l03110704b20ec19e0700@[147.233.159.109]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox