Re: SELECT EXTRACT doesn't work with variables?

From: Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)jp>
To: <cmarin(at)dims(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT EXTRACT doesn't work with variables?
Date: 2002-12-18 14:46:24
Message-ID: 20021218233419.56E2.RK73@sea.plala.or.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 18 Dec 2002 14:03:27 +0100
Conxita Marín <comarin(at)telefonica(dot)net> wrote:

> 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);

Instead of this line, I think you need to execute the following statement:

SELECT INTO aux2 EXTRACT(EPOCH FROM aux);

Regards,
Masaru Sugawara

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message javier garcia 2002-12-18 14:59:02 Linux folders permission - postgresql
Previous Message Ken Guest 2002-12-18 13:51:28 Re: converting string value to integer