X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CEBDE30E543 for ; Thu, 12 Jun 2003 11:16:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 47770-02 for ; Thu, 12 Jun 2003 08:16:31 -0300 (ADT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id E574C30E507 for ; Thu, 12 Jun 2003 08:16:29 -0300 (ADT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Thu Jun 12 13:18:45 2003 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id NAA24575; Thu, 12 Jun 2003 13:16:27 +0200 (METDST) Message-ID: <3EE8610A.EBE8B77@rodos.fzk.de> Date: Thu, 12 Jun 2003 13:16:27 +0200 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org, dpradier@apartia.fr Subject: Re: How to make a IN without a table... ? Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Archive-Number: 200306/95 X-Sequence-Number: 13853 > > i ran today in a problem when doing some (i mean too much for me) advanced sql... > > What i want to do is something like this: > > SELECT > my_var1, > my_var2, > my_function(my_var1, my_var2) > FROM ( > SELECT > '1', > '2', > '3', > '4' > ) AS my_var1_values, > ( > SELECT > '1', > '2', > '3', > '4' > ) AS my_var2_values > > In short, i want to calculate the result of the function my_function for > some values of my_var1, cross by some values of my_var2. > These values are not taken in a table, but put in directly. > They are a lot, so i would prefer not to write the whole thing, line > after line. (Let's say 10 values for the first, and 40 for the second => > 400 lines of code to maintain...) > > I really don't see how to do this :-/ > What about using a TEMP TABLE? And COPY FROM STDIN offers a real fast way to populate. BTW, why using SQL at all? Couldn't perl do the job much easier? Regards, Christoph