simple test code

Поиск
Список
Период
Сортировка
От java4dev
Тема simple test code
Дата
Msg-id 1298395449552-3395857.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: simple test code  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: simple test code  (Vibhor Kumar <vibhor.kumar@enterprisedb.com>)
Список 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 по дате отправления:

Предыдущее
От: siva kiran balijepalli
Дата:
Сообщение: regarding running a script in psql
Следующее
От: java4dev
Дата:
Сообщение: exception problem