java4dev <java4dev(at)gmail(dot)com> writes:
> I have opened a SQL console from the pgAdmin tool and tried to run the
> time1 TIMESTAMP (3);
> time2 TIMESTAMP(3);
> diff INTERVAL;
> time1 := now();
> diff := INTERVAL '30' second;
> time2 := time1 + diff;
> SELECT time1, time2;
> I guess I am doing something wrong but what?
It looks like you're trying to run pl/pgsql code directly as SQL.
Postgres draws a distinction between those things, much more sharply
than Oracle does. You need to create a function to run pl/pgsql
code in. See the examples in the pl/pgsql part of the manual.
(If you're using PG 9.0, you only need a DO block, so the notational
overhead for a throwaway piece of code is a lot less ... but it's
still a distinct environment.)
regards, tom lane
In response to
pgsql-novice by date
|Next:||From: Vibhor Kumar||Date: 2011-02-22 17:45:50|
|Subject: Re: simple test code|
|Previous:||From: java4dev||Date: 2011-02-22 17:34:41|
|Subject: exception problem|