Re: [GENERAL] Functions

From: Simon Drabble <simon(at)eskimo(dot)com>
To: Andrew Perrin - Demography <aperrin(at)demog(dot)berkeley(dot)edu>
Cc: Postgres Group <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] Functions
Date: 1999-11-03 22:06:29
Message-ID: Pine.LNX.4.10.9911031705530.21341-100000@dragon.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 3 Nov 1999, Andrew Perrin - Demography wrote:

> I believe it's $1, $2, etc., so it would be:

Hmmm...then I'm doing something else wrong, cos I'd tried that..

Oh well, thanks for the info.

Simon.

>
> > CREATE FUNCTION fn_fubar(int4) AS
> > 'UPDATE foo SET bar = tmp.numb FROM tmp WHERE tmp.numb = $1'
> > LANGUAGSE 'sql';
>
>
> ---------------------------------------------------------------------
> Andrew J. Perrin - aperrin(at)demog(dot)berkeley(dot)edu - NT/Unix Admin/Support
> Department of Demography - University of California at Berkeley
> 2232 Piedmont Avenue #2120 - Berkeley, California, 94720-2120 USA
> http://demog.berkeley.edu/~aperrin --------------------------SEIU1199
>
> On Wed, 3 Nov 1999, Simon Drabble wrote:
>
> > Ok, following on from the previous stuff, I'm now trying to put that update
> > into a function. How can I reference the passed parameter(s)?
> >
> > CREATE FUNCTION fn_fubar(int4) AS
> > 'UPDATE foo SET bar = tmp.numb FROM tmp WHERE tmp.numb = $$'
> > LANGUAGSE 'sql';
> >
> > where $$ would be the parameter passed to the function:
> >
> > SELECT fn_fubar(20);
> >
> >
> > Simon
> > Buying a SQL book this weekend :)
> >
> >
> >
> > --
> > "Linux - open doors, not windows."
> >
> > Simon Drabble It's like karma for your brain.
> > simon(at)eskimo(dot)com
> >
> >
> > ************
> >
>
>
> ************
>
>

--
"Linux - open doors, not windows."

Simon Drabble It's like karma for your brain.
simon(at)eskimo(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Simon Drabble 1999-11-03 22:08:03 Re: [GENERAL] Functions
Previous Message Scott Perkins 1999-11-03 21:08:00 PHP4 Review "Brand New" Its Hot!