Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group