From: | Tino Wildenhain <tino(at)wildenhain(dot)de> |
---|---|
To: | Zac Hillier <zac(at)affectors(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: foreach in sql functions |
Date: | 2002-10-03 16:57:51 |
Message-ID: | 87652537.1033671471@liza |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | Postg토토 핫SQL : |
Hi Zac,
even better:
INSERT INTO BskDtl (BskKey, PrdKey)
SELECT $1,PrdKey FROM Prd WHERE Sts < 999;
HTH
Tino
--On Mittwoch, 2. Oktober 2002 23:16 +0100 Zac Hillier <zac(at)affectors(dot)net>
wrote:
> Hi All,
>
> I have only recently started using pgsql and would like to try some
> internal functions as it appears this would be quicker than running
> similar functions from php.
>
> Is it possible to write sql functions with a foreach style loop?
>
>
> CREATE FUNCTION crt_bsk_dtl(integer) RETURNS integer AS '
>
> SELECT PrdKey FROM Prd WHERE Sts < 999;
>
> foreach(Prd.PrdKey){
>
> INSERT INTO BskDtl (BskKey, PrdKey) VALUES ($1, Prd.PrdKey);
>
> }
>
> SELECT 1;
> ' LANGUAGE SQL
>
>
> Any help or pointers very much appreciated.
>
> Thanks
>
> Zac
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
From | Date | Subject | |
---|---|---|---|
Next Message | Tino Wildenhain | 2002-10-03 17:05:33 | Re: Anyone want to assist with the translation of the |
Previous Message | Manfred Koizar | 2002-10-03 16:53:32 | Re: [HACKERS] Large databases, performance |