From: | java4dev <java4dev(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | simple test code |
Date: | 2011-02-22 17:24:09 |
Message-ID: | 1298395449552-3395857.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | java4dev | 2011-02-22 17:34:41 | exception problem |
Previous Message | siva kiran balijepalli | 2011-02-21 11:28:30 | regarding running a script in psql |