pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Postgresql <frederes@free.fr>
To: pgsql-sql@postgresql.org
Subject: calling user defined functions with parameters.. ?
Date: Fri, 15 Jun 2001 09:41:42 +0200
Message-ID: <9gcdtc$8q5$1@news.tht.net> (raw)

Hi,

I've created a function like this :

CREATE FUNCTION tester(INT4)
RETURNS BOOL AS
'
DECLARE
 r RECORD;
 p ALIAS FOR $1;

BEGIN
 SELECT INTO r
  id_dpt
 FROM dpts
 WHERE id_dpt=p;

 IF NOT FOUND THEN
  RETURN FALSE;
   ELSE

    RETURN TRUE;
 END IF;
END;
'
LANGUAGE 'plpgsql';

All is ok at creation.
But now , how can i use my function ? i would like a thing like :

SELECT tester(14) AS ok;

But is make a Postgresql parser error

How to do then ??

Thanks for any help or links (other than the postgresql.org website...) !

;)

Regards,

Fred





Message-ID: <9gcdtc$8q5$1@news.tht.net>
Permalink:  ../9gcdtc$8q5$1@news.tht.net/
Also on:    postgresql.org/message-id/9gcdtc$8q5$1@news.tht.net

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: frederes@free.fr
  Subject: Re: calling user defined functions with parameters.. ?
  In-Reply-To: <9gcdtc$8q5$1@news.tht.net>

* 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