SELECT EXTRACT doesn't work with variables?

From: Conxita Marín <comarin(at)telefonica(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: SELECT EXTRACT doesn't work with variables?
Date: 2002-12-18 12:54:46
Message-ID: 000001c2a695$8db0b020$0cd8a8c0@dims
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Browse pgsql-general by date

  From Date Subject
Next Message Conxita Marín 2002-12-18 13:03:27 SELECT EXTRACT doesn't work with variables?
Previous Message SZUCS Gábor 2002-12-18 11:24:28 Re: ORDER BY random() LIMIT 1 slowness