Re: System Date

Поиск
Список
Период
Сортировка
От Chad Wagner
Тема Re: System Date
Дата
Msg-id 81961ff50701181610w6428119dke98d9fc52fa90a1c@mail.gmail.com
обсуждение исходный текст
Ответ на Re: System Date  ("Negandhi, Nishith" <Nishith.Negandhi@infoUSA.com>)
Список pgsql-admin
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