On 1/18/07, Negandhi, Nishith <[EMAIL PROTECTED]> 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 via email to