simple test code - Mailing list pgsql-novice

From java4dev
Subject simple test code
Date
Msg-id 1298395449552-3395857.post@n5.nabble.com
Whole thread Raw
Responses Re: simple test code
Re: simple test code
List pgsql-novice
Hello,

new to Postgresql and have a problem.
I have been using Oracle and MySQL up to now and I was thinking to give
PostgreSQL a try.

I have opened a SQL console from the pgAdmin tool and tried to run the
following

DECLARE
 time1 TIMESTAMP (3);
 time2 TIMESTAMP(3);
 diff INTERVAL;
BEGIN
 time1 := now();
 diff := INTERVAL '30' second;
 time2 := time1 + diff;
 SELECT time1, time2;
END;

but I get an error that I cannot interpret

ERROR:  syntax error at or near "TIMESTAMP"
LINE 3:  time1 TIMESTAMP (3);
               ^

********** Error **********

ERROR: syntax error at or near "TIMESTAMP"
SQL state: 42601
Character: 17

I also tryed to add a label in the beginning

<<test>>
DECLARE
 time1 TIMESTAMP (3);
 time2 TIMESTAMP(3);
 diff INTERVAL;
BEGIN
 time1 := now();
 diff := INTERVAL '30' second;
 time2 := time1 + diff;
 SELECT time1, time2;
END;

but then I get

ERROR:  syntax error at or near "<<"
LINE 1: <<test>>
        ^


********** Error **********

ERROR: syntax error at or near "<<"
SQL state: 42601
Character: 1



I guess I am doing something wrong but what?
--
View this message in context: http://postgresql.1045698.n5.nabble.com/simple-test-code-tp3395857p3395857.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

pgsql-novice by date:

Previous
From: siva kiran balijepalli
Date:
Subject: regarding running a script in psql
Next
From: java4dev
Date:
Subject: exception problem