I'm trying to get this plpgsql function to work:
CREATE OR REPLACE FUNCTION outofdate(actualdate varchar)
RETURNS TABLE(designacion varchar(255),timebeingrotten varchar(255))
AS $BODY$
SELECT designacao, actualdate - prazo
FROM alimento
WHERE prazo < actualdate;
$BODY$
LANGUAGE 'plpgsql' volatile;
SELECT *
From outofdate('12/12/2012');
It keeps giving me an error on line 2 - table ..
ERROR: syntax error at or near
"TABLE" LINE 2: RETURNS
TABLE(designacion
varchar(255),timebeingrotten varch...
^
*** Error ***
ERROR: syntax error at or near "TABLE"
SQL state: 42601 Character: 67
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…