Re: System Date

Поиск
Список
Период
Сортировка
Искать
От
Chad Wagner
Тема
Re: System Date
Дата
Msg-id
81961ff50701181610w6428119dke98d9fc52fa90a1c@mail.gmail.com
Ответ на
Re: System Date (Negandhi, Nishith)
Список
Дерево обсуждения
Re: System Date "Negandhi, Nishith" <Nishith.Negandhi@infoUSA.com>
Re: System Date "Milen A. Radev" <milen@radev.net>
Re: System Date "Chad Wagner" <chad.wagner@gmail.com>
On 1/18/07, Negandhi, Nishith <Nishith.Negandhi@infousa.com> wrote:
Hi Thanx..one more help.
I am creating a function that will retuen the current systemdate.
 
CREATE FUNCTION "CreateDate"() RETURNS date AS
'select now();'
LANGUAGE 'plpgsql';
 
However, I get the error:
 
ERROR:  syntax error at or near "select" at character 51
 
Any suggestions .??
 
Thanks in advance

Syntax is wrong, although I fail to see why you don't just use the "NOW()" function.  I guess I will assume this is just an example.  :)

CREATE OR REPLACE FUNCTION "CreateDate"()
RETURNS DATE AS
$$
DECLARE
   var_date date;
BEGIN
   SELECT NOW()
     INTO var_date;

   RETURN var_date;
END;
$$ LANGUAGE 'plpgsql';



--
Chad
http://www.postgresqlforums.com/
В списке pgsql-admin по дате отправления
От: Negandhi, Nishith
Дата:
Сообщение: Re: System Date
От: Negandhi, Nishith
Дата:
Сообщение: Error in trigger
FAQ