Re: Declaring timestamp variables in function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laurent <lduperval(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Declaring timestamp variables in function
Date: 2011-03-10 23:27:26
Message-ID: 26278.1299799646@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Laurent <lduperval(at)gmail(dot)com> writes:
> CREATE or replace FUNCTION updateDates() RETURNS void AS $$
> declare
> currentDate timestamp(3);
> BEGIN
> currentDate = := round_time(current_date);
> ...
> -- here I update my date
> END;
> $$ LANGUAGE SQL;

> The problem is that my currentDate declaration always generates an
> error:

> ********** Error **********

> ERROR: syntax error at or near "timestamp"

The problem's at the other end of that command :-(. You need to
say language plpgsql, not language sql.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Laurent 2011-03-11 02:22:56 Re: Declaring timestamp variables in function
Previous Message Laurent 2011-03-10 21:35:15 Declaring timestamp variables in function