SELECT EXTRACT doesn't work with variables?

From: Conxita Marín <comarin(at)telefonica(dot)net>
To: "Llista Pqsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: SELECT EXTRACT doesn't work with variables?
Date: 2002-12-18 13:03:27
Message-ID: 000101c2a695$db935900$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?
[Conxita Mar{in]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Manfred Koizar 2002-12-18 13:30:36 Re: converting string value to integer
Previous Message Conxita Marín 2002-12-18 12:54:46 SELECT EXTRACT doesn't work with variables?