Re: create function syntax error

From: "Shoaib Mir" <shoaibmir(at)gmail(dot)com>
To: "gustavo halperin" <ggh(dot)develop(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: create function syntax error
Date: 2006-07-29 20:43:16
Message-ID: bf54be870607291343w397419fcw72677eb3c71c98f3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You are missing the BEGIN and END section. Make your function like this:

CREATE OR REPLACE FUNCTION f_sum() RETURNS void AS '
BEGIN
select 2+2;
END;
' LANGUAGE plpgsql;

Thanks,
--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 7/30/06, gustavo halperin <ggh(dot)develop(at)gmail(dot)com> wrote:
>
> Hello
>
> I Always get "syntax error" for every function that I try to create, for
> example:
> mydb'>create or replace function f_sum () returns void as '
> mydb'> select 2+2;
> mydb'> ' LANGUAGE plpgsql;
> ERROR: syntax error at or near "select" at character 56
> LINE 2: select 2+2;
> ^
>
> What its the problem ??
> Thank you,
> Gustavo
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Jawed 2006-07-29 21:32:54 Re: Auto Installation
Previous Message Andreas Kretschmer 2006-07-29 20:42:30 Re: create function syntax error