plpgsql extract epoch problem

From: Darren Ferguson <darren(at)crystalballinc(dot)com>
To: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql extract epoch problem
Date: 2003-10-22 16:50:22
Message-ID: 3F96B54E.9050801@crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey all

I am trying to extract the epoch from a timestamp variable in plpgsql.
The function is as follows:

create or replace function test() returns integer as '
declare
_test timestamp with time zone;
_f integer;
begin
_test := current_timestamp;
_f := extract(epoch from timestamp _test);
return _f;
end;' language 'plpgsql';

Any ideas why this will not work????

The error is as follows:
pts=> select test();
WARNING: Error occurred while executing PL/pgSQL function test
WARNING: line 6 at assignment
ERROR: parser: parse error at or near "$1" at character 40

And that is the _test variable

Any help greatly apprechiated
Darren

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Ferguson 2003-10-22 17:09:21 Re: plpgsql extract epoch problem
Previous Message Oksana Yasynska 2003-10-22 16:43:31 Re: plpgsql: return multiple result sets or temp table