From: Chad Wagner <chad.wagner@gmail.com>
To: Negandhi, Nishith <Nishith.Negandhi@infousa.com>
Cc: Benjamin Krajmalnik <kraj@illumen.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: System Date
Date: Thu, 18 Jan 2007 19:10:55 -0500
Message-ID: <81961ff50701181610w6428119dke98d9fc52fa90a1c@mail.gmail.com> (raw)
In-Reply-To: <FE0C41EEBEF01C47BF3A91F60669446804973251@PUNISHER.intra.infousa.com>
References: <FE0C41EEBEF01C47BF3A91F60669446804973246@PUNISHER.intra.infousa.com>
<F4E6A2751A2823418A21D4A160B68988029EAA@fletch.stackdump.local>
<FE0C41EEBEF01C47BF3A91F60669446804973251@PUNISHER.intra.infousa.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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: chad.wagner@gmail.com, Nishith.Negandhi@infousa.com, kraj@illumen.com
Subject: Re: System Date
In-Reply-To: <81961ff50701181610w6428119dke98d9fc52fa90a1c@mail.gmail.com>
References: <FE0C41EEBEF01C47BF3A91F60669446804973246@PUNISHER.intra.infousa.com> <F4E6A2751A2823418A21D4A160B68988029EAA@fletch.stackdump.local> <FE0C41EEBEF01C47BF3A91F60669446804973251@PUNISHER.intra.infousa.com> <81961ff50701181610w6428119dke98d9fc52fa90a1c@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox