the correct syntax is
CREATE OR REPLACE FUNCTION test1() RETURNS INTEGER AS '
BEGIN
RETURN 1;
END; '
LANGUAGE 'plpgsql';
you have to be aware of different things.
- the syntax of the language itself is a little bit like pascal.
- sometimes the errorcodes are not very helpfull.
- be beware of the quotes. you must quote the "code block" 'BEGIN ....
END;'
- you have to double quote strings inside the block.
there are usefull examples in the docs
>
>Hi,
>I'm not sure why this does not work.
>
>create or replace function test1() returns int as '
> return 1;
>' LANGUAGE 'plpgsql';
>
>select test1();
>
>--------------------------------------------------------
>
>I also tried this:
>
>create or replace function test1() returns int as '
> select 1;
>' LANGUAGE 'plpgsql';
>
>select test1();
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
_________________________________________________________________
Flexibilität in Ihrem Hotmail-Konto - mehr Möglichkeiten für Ihre E-Mails!
http://join.msn.com/?pgmarket=de-at&DI=1031&XAPID=1581