From: | Eric Prevost-Dansereau <prevoste(at)saturne(dot)clg(dot)qc(dot)ca> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Problem with a PL/pgSQL function |
Date: | 1999-11-08 22:38:50 |
Message-ID: | 99110817441400.02118@eric.clg.qc.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I create that function:
CREATE FUNCTION livreEmprunte(int8)
RETURNS varchar AS '
DECLARE
reponse varchar(200);
noDocu alias for $1;
BEGIN
SELECT CASE
WHEN dateremise > date(now()) then
varchar \'Emprunt jusqu\'\'au \'||
substring(datetime_text(now()) from 21 for 4)||
varchar \'-\'||substring(datetime_text(now()) from 5 for 3)||
varchar \'-\'||substring(datetime_text(now()) from 9 for 2)||
varchar \' par \'||nomembre
WHEN dateremise < date(now()) then
nomembre||
varchar \' devait le remettre le \'||
substring(datetime_text(now()) from 21 for 4)||
varchar \'-\'||
substring(datetime_text(now()) from 5 for 3)||
varchar \'-\'||
substring(datetime_text(now()) from 9 for 2)
ELSE varchar \'Disponible\'
END AS disponibilite
INTO reponse
FROM prets
WHERE montantpaye IS NULL AND nodoc = noDocu;
IF NOT FOUND THEN
reponse:=\'Disponible\';
END IF;
RETURN reponse;
END;
' LANGUAGE 'plpgsql';
The function is created correctly, the PL/pgSQL language is installed correctly
and the select works when I execute it directly from psql prompt.
But when I call the function with: "SELECT livreEmprunte(1);", I receive:
ERROR: fmgr_info: function 20288: cache lookup failed
I'm using RedHat Linux 6.0 wth PostgreSQL 6.5.2
What cause my problem?
Thank you.
ric Prvost-Dansereau
e-mail: eric(at)esc(dot)rosemere(dot)qc(dot)ca
From | Date | Subject | |
---|---|---|---|
Next Message | Moray McConnachie | 1999-11-08 22:42:30 | Re: [SQL] parser :parse error |
Previous Message | raptor | 1999-11-08 21:52:09 | DISTINCT |