calling user defined function with parameters..

From: "Postgresql" <frederes(at)free(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: calling user defined function with parameters..
Date: 2001-06-16 12:56:17
Message-ID: 9gfklv$120h$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message John Scott 2001-06-16 15:16:11 not null - trivial, unexpected behavior
Previous Message Guru Prasad 2001-06-16 05:40:54 Postgres