I create that function:
CREATE FUNCTION livreEmprunte(int8)
RETURNS varchar AS '
DECLARE reponse varchar(200); noDocu alias for $1;
BEGINSELECT 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
disponibiliteINTOreponseFROM pretsWHERE montantpaye IS NULL AND nodoc = noDocu;IF NOT FOUND THEN
reponse:=\'Disponible\';ENDIF;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 Pr�vost-Dansereau
e-mail: eric@esc.rosemere.qc.ca