Re: extracting date from timestamp

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Alexander Borkowski <alexander(dot)borkowski(at)abri(dot)une(dot)edu(dot)au>
Cc: KeithW(at)narrowpathinc(dot)com, pgsql-novice(at)postgresql(dot)org
Subject: Re: extracting date from timestamp
Date: 2005-01-25 04:05:08
Message-ID: 20050125040508.GA8202@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Jan 25, 2005 at 11:14:20AM +1100, Alexander Borkowski wrote:
>
> You have the order for pl/pgsql SELECT INTO wrong (target variable(s)
> first, then the value(s) you want to assign)

Either order is correct:

SELECT INTO var field FROM ...
SELECT field INTO var FROM ...

See the SELECT INTO documentation:

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-SELECT-INTO

"The INTO clause can appear almost anywhere in the SELECT statement.
Customarily it is written either just after SELECT as shown above,
or just before FROM that is, either just before or just after the
list of select_expressions."

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Inpreet Singh 2005-01-25 04:53:27 Restore postgres database problem
Previous Message Tom Lane 2005-01-25 03:39:43 Re: Removing a user's password