Thread: SELECT EXTRACT doesn't work with variables?

SELECT EXTRACT doesn't work with variables?

From
Conxita Marín
Date:
I try to do something like this:

CREATE FUNCTION prova() RETURNS numeric(20,0) AS
'
DECLARE
        aux TIMESTAMP;
        aux2 numeric(20,0);


BEGIN
        aux = ''01.01.2002 00:00:00 CET'';
        aux2 = SELECT EXTRACT(EPOCH FROM TIMESTAMP aux);
        RETURN aux2;
END;
' LANGUAGE 'plpgsql';

I obtain this error:

    NOTICE:  Error occurred while executing PL/pgSQL function prova
    NOTICE:  line 8 at assignment
    ERROR:  parser: parse error at or near "SELECT"

Is this a known bug?