Re: SELECT EXTRACT doesn't work with variables?

From: Conxita Marín <comarin(at)telefonica(dot)net>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'Masaru Sugawara'" <rk73(at)sea(dot)plala(dot)or(dot)jp>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT EXTRACT doesn't work with variables?
Date: 2002-12-18 17:01:00
Message-ID: 003501c2a6b7$0b408940$0cd8a8c0@dims
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: miércoles, 18 de diciembre de 2002 17:00
To: Masaru Sugawara
Cc: cmarin(at)dims(dot)com; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] SELECT EXTRACT doesn't work with variables?

Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)jp> writes:
> Conxita Marín <comarin(at)telefonica(dot)net> wrote:
>> 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);

Or

aux2 = EXTRACT(EPOCH FROM TIMESTAMP aux);

This works: SELECT INTO aux2 EXTRACT(EPOCH FROM aux);

This doesn't work: aux2 = EXTRACT(EPOCH FROM TIMESTAMP aux);

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

Thanks to all.

Conxita.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-12-18 17:06:57 Re: Regarding select distinct ...query
Previous Message Lee Kindness 2002-12-18 16:59:21 Table Timemachine!